2
googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng point) {
MarkerOptions marker = new MarkerOptions().position(
new LatLng(point.latitude, point.longitude)).title("New Marker");
mMap.addMarker(marker);
System.out.println(point.latitude+"---"+ point.longitude);
}
});}}
in case this code adds a new marker on the map, plus each click I give adds a new marker, then I want to Remove the old marker when add a new one
Newbie, Voce already tried
mMap.clear()
– Alexandre Soares Machado
Newbie, put the solution on the record, it helps the next ones to search.
– Alexandre Soares Machado
In this case it would not be better to create the marker once and move when clicking?
– Bacco