3

I am using ClusterManager to group the markers in android application.

I want to get list of markers and use

mClusterManager.getMarkerCollection().getMarkers();

This method returns no markers when we zoom out.and returns markers only when zoom in to show all markers.is there any way to get all markers ?

Jithin Sunny
  • 3,352
  • 4
  • 26
  • 42
  • Could you elaborate a little? When you say you want to get a list of markers do you mean all the cluster markers? (because a cluster on the map is a single marker with a number on it) or do you want a list of markers a cluster has when clusted? If you say ClusterMarker I will assume you mean the marker on the map representing a cluster. – Unknownweirdo Aug 20 '14 at 11:20
  • 1
    @Losin'Me i mean list of markers within a cluster(list of markers a cluster has when clusted). – Jithin Sunny Aug 20 '14 at 11:38
  • From a cluster that you have clicked? or just all the clusters? – Unknownweirdo Aug 20 '14 at 11:45
  • All clusters. I need this because i have to change marker icon depending on user input.Is there any other way to do this? – Jithin Sunny Aug 20 '14 at 11:48
  • Wait what happens if you use mClusterManager.getClusterMarkerCollection() instead? you wanted the list of cluster markers no? – Unknownweirdo Aug 20 '14 at 11:54
  • mClusterManager.getClusterMarkerCollection() returns one item if one cluster is shown.The cluster says 100+ and i want that 100+ items.Sorry for late reply – Jithin Sunny Aug 20 '14 at 12:31
  • But if there is 2 clusters both with 100, you want to get all 200 in one go!? – Unknownweirdo Aug 20 '14 at 12:47
  • hi , Have you found any solution ? – Pouya Heydari Jan 08 '18 at 09:15

1 Answers1

2

Try this:

java.util.Collection<Marker> userCollection = mClusterManager.getMarkerCollection().mMarkers;       
ArrayList<Marker> userList = new ArrayList<Marker>(userCollection);
Log.d("list", "size: " + userList.size());
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199