When does the canvas' onDraw function get called?

by Mariano Kamp » Fri, 06 Mar 2009 06:01:23 GMT


Sponsored Links
 after the state of something you are interested in changes you can call
invalidate() on the canvas which will afaik cause the canvas to be redrawn
as soon as the UI thread gets to it.





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. why i cant have back my location ??!!!!! HELP

guys i am just following a simple example here where i need to get my
location lat and longitude but its not working although its so simple i cant
find where i fall

but here is my code

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        LocationManager locationManager ;
        String context = Context.LOCATION_SERVICE;
        locationManager = (LocationManager)getSystemService(context);

        Criteria myCriteria = new Criteria();
        myCriteria.setAccuracy(Criteria.ACCURACY_FINE);
        myCriteria.setAltitudeRequired(false);
        myCriteria.setBearingRequired(false);
        myCriteria.setCostAllowed(true);
        myCriteria.setPowerRequirement(Criteria.POWER_LOW);

        String provider = locationManager.getBestProvider(myCriteria, true);

        Location myLocation =
locationManager.getLastKnownLocation(provider);

        if (myLocation != null)
        updateWithNewLocation(myLocation,provider);

        //locationManager.requestLocationUpdates(provider, 200000, 300,
locationListener);

        }

    private void updateWithNewLocation(Location myLocation,String provider)
{
        // TODO Auto-generated method stub
        String latLongString;
        TextView myLocationText;
        myLocationText = (TextView)findViewById(R.id.myLocationText);
        if (myLocation!=null)
        {

            double lat = myLocation.getLatitude();
            double lng = myLocation.getLongitude();
            latLongString = "Lat:" + lat + "\nLong" + lng + "\n" + provider
;

        }
        else {
            latLongString = "No Location Found" + provider ;
            }
        myLocationText.setText("My current position is :\n"+ latLongString);
        }



    private final LocationListener locationListener= new LocationListener(){
    public void onLocationChanged(Location location){
        updateWithNewLocation(location,"x");
           }

    public void onProviderDisabled(String provider){
        updateWithNewLocation(null,"x");
        }
    public void onProviderEnabled(String provider){}

    public void onStatusChanged(String provider,int status,Bundle extras){}



    };


}
-- 
Regards

Abdalrahman Eweiwi
Msc in Media Informatics
RWTH-AACHEN
B-it

--~--~---------~--~----~------------~-------~--~----~

2. Opening audio output failed

Hello Group,

I'm working on Linux (Ubuntu if it matters, latest kernel).
When I start the emulator I get the following message (without the
quotes).
"emulator: warning: opening audio output failed"

I am unable to play any sound on my emulator - though doing so, does
NOT cause the emulator to crash or do anything else destructive.

My sound output device is 'ALSA' - and it is otherwise working
flawlessly.

This is all on my personal Toshiba laptop.
The same occurres at my school laboratories using what I believe to be
Ubuntu with ALSA as well.

Can this be solved?
David

--~--~---------~--~----~------------~-------~--~----~

3. ListView + SimpleAdaptor + ImageView => very slow

4. Refresh of MapView

5. Trouble redrawing a View, using OnKeyListener, onDraw and invalidate.

6. Trouble migrating apps to 1.5

7. Some Probleme with Tic Tac Toe