Thursday, 22 August 2013

Wait onLocationChanged(Location location)

Wait onLocationChanged(Location location)

I need to get current location, and after that - do next code. How can i
wait while this method has finished? onLocationChanged is called
automatically that why i have problem. Do someone has any ideas how to do
itmore correct? I make it very stupid, in OnLocationChanged() i call
onResume(), but it is so bad idea.
@Override
public void onLocationChanged(Location location) {
final Location loc = location;
Log.d("myLogs", "OnChange2");
Log.d("myLogs", "2" + loc.getLatitude() + "," + loc.getLongitude());
myLat = loc.getLatitude();
myLong = location.getLongitude();
onResume();
}

No comments:

Post a Comment