Rio Marie A. Callos Rio Marie A. Callos - 1 year ago 342
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... ;-)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download