EDIT: This question is in reference to Google Maps on Android.
I am trying to make custom info window for markers with clustering. I followed the instructions given here https://stackoverflow.com/a/21964693/1641882
I did these :
Setup the cluster manager to act as info window adapter
// Setting custom cluster marker manager for info window adapter
map.setInfoWindowAdapter(mClusterManager.getMarkerManager());
mClusterManager.getMarkerCollection().setOnInfoWindowAdapter(new MyLocationInfoWindowAdapter());
Set a click listener for clusterItem info window
mClusterManager.setOnClusterItemInfoWindowClickListener(new ClusterManager.OnClusterItemInfoWindowClickListener<LocationMarker>() {
@Override
public void onClusterItemInfoWindowClick(LocationMarker locationMarker) {
Toast.makeText(context, "info window Click", Toast.LENGTH_SHORT).show();
}
});
Here is my Info Window Adapter
private class MyLocationInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
@Override
public View getInfoWindow(Marker marker) {
return null;
}
@Override
public View getInfoContents(Marker marker) {
TextView helloTextView = new TextView(getContext());
helloTextView.setText("Hello Info contents");
helloTextView.setClickable(false);
return helloTextView;
}
}