Android - Google maps V2 - Removing a groundoverlay

2.1k Views Asked by At

My app uses google maps v2, I add a groundoverlay to my map. Does anyone know how I can remove this overlay?

Thanks

.remove() doesn't seem to available

enter image description here

1

There are 1 best solutions below

3
N Dorigatti On BEST ANSWER

there is the method remove(): https://developers.google.com/android/reference/com/google/android/gms/maps/model/GroundOverlay.html#remove()

You just have to keep a reference to the ground overlay when you create it:

 GroundOverlay groundOverlay = map.addGroundOverlay(new GroundOverlayOptions()
     .image(image)
     .positionFromBounds(bounds)
     .transparency(0.5));

then remove:

groundOverlay.remove();