Java – How do I refresh marker locations on Google Maps without clearing and flashing map?

How do I refresh marker locations on Google Maps without clearing and flashing map?… here is a solution to the problem.

How do I refresh marker locations on Google Maps without clearing and flashing map?

Is it possible to create Google Maps V2 tags that can be updated without flashing/clearing the entire map?
Currently I have to clear the map and then add the tag:

googleMap.clear();
googleMap.addMarker(new MarkerOptions().position(entry.getValue()).title(entry.getKey()));

But map flashes when clear….

Solution

addMarker returns the Marker object.

Marker marker = googleMap.addMarker(new MarkerOptions().position(entry.getValue()).title(entry.getKey()));

Use this object to change its position:

marker.setPosition(new LatLng(5, 5));

Related Problems and Solutions