当我调用此方法时,蓝点不会出现在地图上,直到我从ddms发送位置, 然后突然出现了。
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();
}
如何在调用此方法后立即显示蓝点? 非常感谢。
答案 0 :(得分:2)
如何在调用此方法后立即显示蓝点?
你不能。
顾名思义, MyLocationOverlay
显示用户的位置。如果设备/模拟器不知道用户的位置,则无法显示该位置。
在设备的情况下,在确定了所述位置(例如GPS)之前,它不会显示用户的位置。
对于模拟器,在确定所述位置(例如DDMS)之前,它不会显示用户的位置。