Rio Marie A. Callos Rio Marie A. Callos - 10 months ago 252
Android Question

Google Maps Android Clustering OnCameraChangeListener() deprecated

Using the tutorial here, I successfully implemented clustering in my Android app. Since OnCameraChangeListener() is now deprecated in is there a new way to implement the part below?

private ClusterManager<MyItem> mClusterManager;


I tried directly replacing setOnCameraChangeListener by setOnCameraMoveListener like


This does not work since setOnCameraMoveListener() is expecting an object of class OnCameraMoveListener. Casting mClusterManager does not work either.

googleMap.setOnCameraMoveListener((GoogleMap.OnCameraMoveListener) mClusterManager);

Answer Source

You need to use


instead of


You can to search for the source code of ClusterManager and you will see that ClusterManager implements the new OnCameraIdleListener.

Also you need to update to new android-maps-utils:0.4.4

(compile '')

Good luck and vote up... ;-)