Is it possible to clear all the google maps markers EXCEPT the selected one (the one displaying an info window), and keep its info window open?
I'm using this code to refresh my map, it is clearing all the markers and add new ones according to where the camera is :
googleMap.clear();
// Save all the marker which will be kept on a new list, remove the others
for (int j = 0; j < markers.size(); j++) {
googleMap.addMarker(markers.get(j));
}
But as the info windows are clickable and on click open a new fragment, I want the selected marker to be spared from this clear()
, so the marker and its info window don't disappear. I would like to achieve this by using the method provided in the google map object rather than loop on a list of markers, which can take a lot of time.
Thanks.