How to get Google Maps object inside a Fragment

前端 未结 7 1911
走了就别回头了
走了就别回头了 2021-02-19 01:26

I am using fragments in my application and I am new for this. There is a fragment in which I want to display Google Map and want to get its object, for this I have a fragment in

7条回答
  •  一生所求
    2021-02-19 01:53

    
    
    View root= inflater.inflate(R.layout.fragment_a_t_m_locations, container, false);
        SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.location_map);
        mapFragment.getMapAsync(googleMap -> {
            mMap=googleMap;
            if(mMap!=null){
                mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
            }
        });
    

提交回复
热议问题