我怎么能在Android上做运动地理点?

时间:2012-04-06 11:53:34

标签: android location android-mapview point geo

我想在mapview上显示用户位置,我可以。但是当用户此时移动到另一个位置时我无法更新geopoint - 当看地图时 - 我该怎么做?

     List<Overlay> mapOverlays = mapView.getOverlays();
     Drawable drawable = this.getResources().getDrawable(resID);
     HelloItemizedOverlay itemizedoverlay = new        HelloItemizedOverlay(drawable,this);
     GeoPoint point = new GeoPoint((int)latd,(int)lond);
     OverlayItem overlayitem = new OverlayItem(point, name, name);
     itemizedoverlay.addOverlay(overlayitem);
     mapOverlays.add(itemizedoverlay);

1 个答案:

答案 0 :(得分:0)

在您的onLocationChanged() Location Listener中,您需要再次编写相同的代码,

     List<Overlay> mapOverlays = mapView.getOverlays(); 
     mapOverlays.clear() // add this to remove previous
     Drawable drawable = this.getResources().getDrawable(resID); 
     HelloItemizedOverlay itemizedoverlay = new        HelloItemizedOverlay(drawable,this); 
     GeoPoint point = new GeoPoint((int)latd,(int)lond); 
     OverlayItem overlayitem = new OverlayItem(point, name, name); 
     itemizedoverlay.addOverlay(overlayitem); 
     mapOverlays.add(itemizedoverlay);