Using the tutorial here, I successfully implemented clustering in my Android app. Since OnCameraChangeListener() is now deprecated in com.google.android.gms:play-services:9.4.0 is there a new way to implement the part below?
private ClusterManager<MyItem> mClusterManager;
googleMap.setOnCameraChangeListener(mClusterManager);
EDIT:
I tried directly replacing setOnCameraChangeListener by setOnCameraMoveListener like
googleMap.setOnCameraMoveListener(mClusterManager);
This does not work since setOnCameraMoveListener() is expecting an object of class OnCameraMoveListener. Casting mClusterManager does not work either.
googleMap.setOnCameraMoveListener((GoogleMap.OnCameraMoveListener) mClusterManager);
You need to use
gooleMap.setOnCameraIdleListener(mClusterManager);
instead of
googleMap.setOnCameraMoveListener(mClusterManager);
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 'com.google.maps.android:android-maps-utils:0.4.4')
Good luck and vote up... ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With