androidgoogle-mapsmarkermarkerclusterer

How to get click on the android cluster group?


I am not able to click on the android cluster group, even after I tried different solutions.

The first solution was to split the cluster using the below solution:

override fun shouldRenderAsCluster(cluster: Cluster<PlaceMedico>): Boolean {
        return cluster.size > 1
    }

It didn't work as some of the clusters are not splitting.

The second solution was to get click on the cluster group as shown below screenshot, but I am getting click only in the marker, not the cluster:

clusterManager.setOnClusterItemClickListener { item ->
                return@setOnClusterItemClickListener false
}

I need to click on the cluster group, to show data of each item in the cluster on a custom view. Is this possible?

enter image description here


Solution

  • You need to use setOnClusterClickListener

    clusterManager.setOnClusterClickListener { item ->
                    ..........
    }
    

    Check this question, is the opposite of your problem

    Google maps android on cluster items click not working