How Do You Implement "follow Me" Using The Mylocationoverlay Class?
I made an application which shows the current location of the user using the MyLocationOverlay class. However, when the user changes his location, the marker is not recentered. How
Solution 1:
What I do is extend MyLocationOverlay
as an inner class of my MapActivity
. Then, I override onLocationChanged
and use animateTo
on my MapController
in that method.
@Override
public synchronized void onLocationChanged(Location location) {
if (location != null) {
mapController.animateTo(
new GeoPoint((int) (location.getLatitude()*1e6),
(int) (location.getLongitude()*1e6));
}
super.onLocationChanged(location);
}
Post a Comment for "How Do You Implement "follow Me" Using The Mylocationoverlay Class?"