@Override public void onAdd() { mClusterManager .getMarkerCollection() .setOnMarkerClickListener( new BaiduMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { return mItemClickListener != null && mItemClickListener.onClusterItemClick(mMarkerCache.get(marker)); } }); mClusterManager .getClusterMarkerCollection() .setOnMarkerClickListener( new BaiduMap.OnMarkerClickListener() { @Override public boolean onMarkerClick(Marker marker) { return mClickListener != null && mClickListener.onClusterClick(mMarkerToCluster.get(marker)); } }); }
@Override public void onRemove() { mClusterManager.getMarkerCollection().setOnMarkerClickListener(null); mClusterManager.getClusterMarkerCollection().setOnMarkerClickListener(null); }