You can easily remove an overlay from your overlay list.
First you must have a MapView and obviously an Overlay.
private MapView map=null;
Overlay MyOverlay = new Overlay(....);
Then you can choose between removing the overlay referencin the object name
(overlay name) o with its index (position in the overlay list).
map.getOverlays(); --> This is the list with all the overlays you have in
the MapView.
The same way you add an overlay: --> map.getOverlays().add("object
name/index position");
You can remove it: --> map.getOverlays().remove("object name/index
position");
You might want to save the index position at the time you create the
overlay:
Overlay MyOverlay = new Overlay(....);
int MyOverlayPosition = map.getOverlays().IndexOf(MyOverlay);
and then remove it whenever you want.
map.getOverlays().remove(MyOverlayPosition);
Hope this is usefoul to you. I just started with android so im not much of
an expert :)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en