Android GoogleMap or SupportMapFragment - null pointer exception

前端 未结 8 2007
心在旅途
心在旅途 2021-02-10 10:51

In my app i showing google map version2 in a fragment. but i get Null pointer exception at

mMap = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id

8条回答
  •  一整个雨季
    2021-02-10 10:58

    May be above answers work but what work for me is this.

     {
        SupportPlaceAutocompleteFragment supportPlaceAutocompleteFragmentSearch;
        FragmentManager fragmentManagerSearch = getChildFragmentManager();
        supportPlaceAutocompleteFragmentSearch = 
                                                (SupportPlaceAutocompleteFragment)
                                                fragmentManagerSearch.findFragmentById(R.id.place_autocomplete_fragment_search);
        }
    

提交回复
热议问题