I have a general question about LocationListener in Android. Perhaps it is about the events of Android or Java in general, but not sure.
There seem to be a million ways to tweak the LocationListener, and they all seem pretty ugly (mainly due to the lack of reuse). Here is an example from android found here :
LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
makeUseOfNewLocation(location);
}
public void onStatusChanged(String provider, int status, Bundle extras) {}
public void onProviderEnabled(String provider) {}
public void onProviderDisabled(String provider) {}
};
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
This works, but I'm really surprised that this is the standard way to write OOP code ...
, , - LocationListener. - , ? , , gps-... , ? !