Delete all overlays

I have the following code to add Overlay

myMapView.getOverlays().add(sites); myMapView.invalidate(); 

I also have the following delete code, where sites are a global variable.

 if (sites != null) { // myMapView.getOverlays().clear(); myMapView.getOverlays().remove(sites); myMapView.invalidate(); sites = null; } 

Sometimes I leave duplicates, so I would like to remove all overlays from the map, is this possible?

+4
source share
1 answer

Looks like I always had the answer!

myMapView.getOverlays (). Clear()

+25
source

All Articles