android中的setOnMyLocationListener错误

月神

我无法设置 myLocationChange 侦听器。我的代码如下,我试图在 OnMapReady 方法中设置MyLocationChangeListener。

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        mapView.getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(final GoogleMap mMap) {
                googleMap = mMap;
                googleMap.setMyLocationEnabled(true);
                googleMap.setOnMyLocationChangeListener(this);

    }

感谢您的帮助

安东尼奥

thisingoogleMap.setOnMyLocationChangeListener(this);指的是OnMapReadyCallback(内部类)。

如果您的外部类实现,LocationListener您需要指定它:googleMap.setOnMyLocationChangeListener(YourClass.this);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章