Skip to content Skip to sidebar Skip to footer

Marker Is Not Removing From MapV2 Android

I am adding a maker on touch of map and want to remove that marker on click of some button but that marker is not removing from map .Here is my Code // Marker of end Point Mark

Solution 1:

You are adding same marker twice:

                endPointMarker = mMap.addMarker(new MarkerOptions()
                        .position(new LatLng(lat, lng))
                        .title("Location").snippet("" + address));

                markers.add(mMap.addMarker(new MarkerOptions()
                        .position(new LatLng(lat, lng))
                        .title("Location").snippet("" + address)));

Just remove one call to GoogleMap.addMarker.


Solution 2:

what you are doing is correct but if this is not working then You can use mMap.clear() inside your onclick method this will remove all the markers or if you want only a specific marker not to be shown then you can use endPointMarker.setVisible(false)


Post a Comment for "Marker Is Not Removing From MapV2 Android"