My question refers to the new Google Maps API v2 in Android.
We can easily get the LatLng(point) on Google Maps, if setting the below;
@Override
public void onMapClick(LatLng point) {
}
And if want to add the marker whenever touching on Google Map, we do the below;
@Override
public void onMapClick(LatLng point) {
googleMap.addMarker(
new MarkerOptions().
position(point).
title("Hello World"));
}
Then we can get both the marker and LatLng(point) where we touch on map.
But the problem is that all markers DO NOT disappear whenever touching on map.
Question 1: Whenever I touch on map, I want to add just the last marker on map. As you may know, to do this,we can add "googleMap.clear()" before adding "addmarker()" in the code. But does another method exist ?
Question 2: When the only one marker exists on map,I want to add just my second marker on map using touching on the maps, "onMapClick". In short, I don't want to add the third marker on the map within "public void onMapClick(LatLng point){}". How?