So I have around 850 markers that I have on my map, and I have already implemented the cluster manager successfully, but I can't seem to figure out how I can set each marker's title (which I have kept in a list). I have already tried the below code, but all of the marker's title's are then set to the first item in the list. Any thoughts?
Jacob
Here is the code I've tried (where universityName is the list)
mClusterManager.getMarkerCollection().setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
for(int i = 0; i < 835; i++) {
marker.setTitle(universityName.get(i));
}
return false;
}
});
Here is my MyClass:
class MyItem implements ClusterItem {
private final LatLng mPosition;
public MyItem(double lat, double lng) {
mPosition = new LatLng(lat, lng);
}
@Override
public LatLng getPosition() {
return mPosition;
}
}