The only method that removes markers from map is clear. However it clears all markers from the map.
I want to remove only single marker or group of markers.
How could i achieve this?
The only method that removes markers from map is clear. However it clears all markers from the map.
I want to remove only single marker or group of markers.
How could i achieve this?
After adding the marker it is possible to obtain its reference:
Marker marker = map.addMarker(..);
The Marker
class has a remove
method:
I got the same problem, so to fix it I'm doing
mMap = super.getMap();
map.clear();
I wrote up a blog post on how to remove Markers when they are moved off the screen, and adding them again when they are on the screen. This is useful if you are trying to add thousands of Markers to a GoogleMap at the same time but don't want the performance to suffer as much as it would if they are all on the map at the same time. It uses the same method you detailed (calling remove() on a Marker).
Hiding and Showing on screen Markers with Google Maps Android API V2