0

1: Example enter image description here

This picture represents a group of clusters(the ones that have the text in the middle) and a cluster Item, which is only one item of a specific type.

What I'm trying to achieve is that on a cluster item, I want to add some text, for example "1", which represents that is only a cluster item, therefore there is only one item in there.

I managed to get the text working on the group of clusters but not on the cluster item.

The code that does the trick in my case it's this one:

String place = item.getPlaceName();
            if (place.length() > 12)
                place = place.substring(0, 10) + "..";
            placeAddressAndLocation.setText(place);

Now I am not aware where should I place the exact code for the cluster item.

In the example found on google dev(which is the one I'm also following), there are a couple of methods for these

protected void onBeforeClusterItemRendered

protected void onClusterItemRendered

Tried adding the code on both of the methods, but it doesn't do anything. Any suggestions? Thanks!

funkycookie
  • 226
  • 2
  • 16

1 Answers1

0

If you want to use onBeforeClusterItemRendered, you can try with this answer.

So in the onBeforeClusterItemRendered method, you can set the attributes of markerOptions.

You might want to try to set the title, snippet or icon of the markerOptions, you can read the documentation of the markerOptions.

Community
  • 1
  • 1
ztan
  • 6,861
  • 2
  • 24
  • 44
  • thanks, but I don't want to display an infoWindow, basically I'm trying to set some text to a cluster with one item. I got this working for a cluster with multiple items though – funkycookie Jan 08 '15 at 08:56
  • Can you include more codes about how you make one cluster with multiple items working? Also a screenshot of your current screen will be nice. – ztan Jan 08 '15 at 18:38
  • It's fixed! A cluster is declared twice, like this: private View checkinView = getActivity().getLayoutInflater().inflate(R.layout.frame_checkincluster, null); private View clusterView = getActivity().getLayoutInflater().inflate(R.layout.frame_checkincluster, null); One of the declarations is for the Clusters while the other one is for the Cluster Items :) – funkycookie Jan 09 '15 at 11:38