Reputation: 1296
I added some Markers in my map and now I want to remove them. Is there any method that I can use to remove my Marker? I used MarkerOptions class to build my Markers and add() method of GoogleMap to add them. And I have a reference of all of my Markers in a List. I really need your help.
Upvotes: 0
Views: 658
Reputation: 2955
After adding the marker it is possible to obtain its reference:
Marker marker = map.addMarker(..);
Marker class has remove method: https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#remove
Removes this marker from the map. After a marker has been removed, the behavior of all its methods is undefined.
marker.remove()
It will remove all the markers. use this one to remove particular one
for(Marker m : marker)
m.remove();
Upvotes: 1