baloo
baloo

Reputation: 217

Remove Single item from map

I am able to display markers using google map v2. Now I want to remove a single marker but unable to do it. I tried using clear method but it removes all the markers.

Upvotes: 1

Views: 123

Answers (3)

Senthil
Senthil

Reputation: 1244

trythis

List<Overlay> mapOverlays = mapView.getOverlays();

.....
.....
mapOverlays.remove(position);

Upvotes: 0

Dhaval Parmar
Dhaval Parmar

Reputation: 18978

if you are using

Marker _marker = map.addMarker(new MarkerOptions()
     .position(new LatLng(37.7750, 122.4183))
     .title("San Francisco")
     .snippet("Population: 776733"));

for remove marker

_marker.remove();

Removes this marker from the map. After a marker has been removed, the behavior of all its methods is undefined.

Upvotes: 1

Analizer
Analizer

Reputation: 1644

Try marker.remove(), it will do the job

Upvotes: 0

Related Questions