0

i wanna display user location on mapview and i could it. but i cant update geopoint when user move to another location at this time - when look the map- how can i do that?

     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);
enginar
  • 307
  • 1
  • 6
  • 16

1 Answers1

0

in your onLocationChanged() of your Location Listener you need to write the same code again,

     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); 
MKJParekh
  • 34,073
  • 11
  • 87
  • 98