I need to do the following: I have a Marker on the map and I need to change the position of it. So I tried the following:
MarkerOptions a = new MarkerOptions
Define "marker" outside the function. for the first time, it will be null and "if" condition will be executed. for the second time "else" will be executed.
Marker marker = null;
protected void onPostExecute(Coordinates coordinates) {
LatLng latLong = new LatLng("lat", "long");
if (marker == null) {
MarkerOptions options = new MarkerOptions().position(latLong)
.title("Marker Title");
marker = mMap.addMarker(options);
}
else {
marker.setPosition(latLong);
}
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLong));
mMap.animateCamera(CameraUpdateFactory.zoomTo(16f));
}