My android using the Google map android API,InfoWindow\'s image not showing on first click, but it works on second click
I customize the infoWindow using
I think Google has been listening and here's the solution that works for me. While setting up the cluster,
getMap().setOnMapLoadedCallback(mOnMapLoaded);
And once the map gets loaded, all the markers can be retreived from the clusterManager,
private GoogleMap.OnMapLoadedCallback mOnMapLoaded = () -> {
LogUtil.i(TAG, "Map has been loaded.");
showInfoWindow();
};
private boolean showInfoWindow() {
final WorkHeader selected = mWorkContainer.getSelectedHeader();
Collection markers = mClusterManager.getMarkerCollection().getMarkers();
for (Marker marker : markers) {
if (marker.getTitle().contains(selected.siteName)) {
if (marker.getTitle().contains(selected.siteAddress)) {
mClusterManager.onMarkerClick(marker);
return true;
}
}
}
return false;
}