Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove all Overlays

I have the following code to add an Overlay

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

I also have the following remove code where sites is a global variable.

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

Sometimes I am left with duplicates so would like a way to remove all overlays from a map, is this possible?

like image 866
Lee Armstrong Avatar asked Nov 29 '22 04:11

Lee Armstrong


1 Answers

Looks like I did have the answer all along!

myMapView.getOverlays().clear()

like image 143
Lee Armstrong Avatar answered Dec 10 '22 06:12

Lee Armstrong