How to remove a particular marker from Google Map in Android

android, google-maps-android-api-2

Solution

As mention here in documentation , `Remove()` method in Marker class will help you

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#remove()

and here tutorial about adding and removing markers on map

http://www.jiahaoliuliu.com/2013/08/android-adding-and-removing-markets-on.html

Problem

I add a marker on each map click, and I only want to see the last one. I tried the following code: ``` if(marker!=null) { marker.visible(false); marker=null; } marker=new MarkerOptions().position(latLng); googleMap.addMarker(marker); ``` I see every marker even though I set it to invisible. How can I remove after each click? I can't find any remove methods.

Original source

Related problems