Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将OnMapReadyCallback设置为我的MapView实例?_Android_Google Maps - Fatal编程技术网

Android 如何将OnMapReadyCallback设置为我的MapView实例?

Android 如何将OnMapReadyCallback设置为我的MapView实例?,android,google-maps,Android,Google Maps,我的布局中提供了一个Google Map APIMapView: <com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/map_view" ... /> 正如您在上面看到的,我已经覆盖了onMapReady(GoogleMap-GoogleMap),因为我正在实现OnMapReadyCallback接口

我的布局中提供了一个Google Map API
MapView

<com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto"
            android:id="@+id/map_view"
...
/>
正如您在上面看到的,我已经覆盖了
onMapReady(GoogleMap-GoogleMap)
,因为我正在实现
OnMapReadyCallback
接口

但是,如何将
mMapView
的侦听器设置为侦听map ready事件

我尝试了
mMapView.setOnMapReadyCallback(this)
,但在
MapView
中没有这样的方法可以使用

getMapAsync(OnMapReadyCallback callback)
就你而言

mMapView.getMapAsync(this);
您可以找到文档

mMapView.getMapAsync(this);