问题描述
使用的教程,我成功实施集群在我的Android应用程序。由于OnCameraChangeListener()现在在com.google.android.gms中已被弃用:play-services:9.4.0是否有一种新的方式来实现下面的部分?
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);
编辑:
通过setOnCameraMoveListener设置setOnCameraChangeListener像
I tried directly replacing setOnCameraChangeListener by setOnCameraMoveListener like
googleMap.setOnCameraMoveListener(mClusterManager);
这是行不通的,因为setOnCameraMoveListener()期望类OnCameraMoveListener的对象。 Casting 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
而不是
您可以搜索ClusterManager的源代码,您将看到ClusterManager实现了新的OnCameraIdleListener。
You can to search for the source code of ClusterManager and you will see that ClusterManager implements the new OnCameraIdleListener.
您还需要更新到新的android-maps-utils:0.4。 4
Also you need to update to new android-maps-utils:0.4.4
祝你好运并投票结果......; - )
Good luck and vote up... ;-)
这篇关于Google Maps Android群集OnCameraChangeListener()已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!