Home » Android » Updating a map marker in android

Updating a map marker in android

Posted by: admin June 15, 2020 Leave a comment


Using Google Maps Android API v2, I can update my marker’s position by getting the Marker from a hashMap and then calling:

Marker marker = hashMap.get(someId);
marker.setPosition(new LatLng(newLatitude, newLongitude));

However, if the marker is selected when this is called, the title and snippet will only update if I click off the marker and reselect it. Is there anyway to tell the map to refresh the data in the marker bubble?

How to&Answers:

Call hideInfoWindow() immediately followed by a call to showInfoWindow(), like this: