MyLocationOverlay doesn't appear
when I call this method the blue dot is not appearing on the map, until i send location from ddms, then suddenly it appears.
private void findMyLocation(final Location location){
final 开发者_如何转开发MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
myLocationOverlay.enableMyLocation();
myLocationOverlay.enableCompass();
final GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1E6),
(int) (location.getLongitude() * 1E6));
controller.animateTo(point);
controller.setCenter(point);
mapView.getOverlays().add(myLocationOverlay);
mapView.postInvalidate();
}
how can i show that blue dot right after calling this method? thanks a lot.
how can i show that blue dot right after calling this method?
You can't.
MyLocationOverlay
, as its name suggests, shows the user's location. If the device/emulator does not know the user's location, it cannot show it.
In the case of the device, it will not show the user's location until it has determined said location (e.g., GPS).
In the case of the emulator, it will not show the user's location until it has determined said location (e.g., DDMS).
精彩评论