即使调用getMapAsync后,android google maps onMapReady也不执行

时间:2019-04-20 09:23:51

标签: java android google-maps

Android中集成的Google地图,但从适配器类移至此Map_Activity.class时未调用OnMapReady()回调方法。

 mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(Maps_location.this);


//Call back method
 @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;
        mMap.setOnCameraIdleListener(this);
        mMap.setOnCameraMoveStartedListener(this);
        mMap.setOnCameraMoveListener(this);
        mMap.setOnCameraMoveCanceledListener(this);
}

//Adapter class using Intent through context to move to maps activity

holder.loca_edit_layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(context, Maps_location.class);
                intent.putExtra("act", "edit_act");
                intent.putExtra("loc_name", loc_name);
                intent.putExtra("lat", loc_lat);
                intent.putExtra("lng",loc_lng);
                intent.putExtra("loc_addrs",loc_addrs);
                intent.putExtra("loca_flat",loc_flat_no);
                intent.putExtra("loca_landmark",loc_landmark);

                context.startActivity(intent);
            }
        });

0 个答案:

没有答案