Issue
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);
Solution
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);
Answered By - MKJParekh
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.