I want to remove a current marker after long click on map anywhere and recreate a new marker at that point. I have cleared google map on long click on map and new marker is crea
Please try the blow code :-
// Global Variable...
private Marker mPreviousMarker ;
@Override
public boolean onMarkerClick(Marker marker) {
if (mPreviousMarker != null) {
mPreviousMarker.remove();
}
mPreviousMarker = googleMap.addMarker(new MarkerOptions().position(latLng).icon(bitmapDescriptor));
}
LatLng :- Your latlong where you want to add and bitmapDescroptor is icon. {Just for understanding}