Android, google maps fragment and viewpager - Error inflating class fragment

后端 未结 2 1424
独厮守ぢ
独厮守ぢ 2021-02-05 16:27

i\'m trying to use google maps v2 within viewpager (fragmentpager) in a fragment. It works fine if i swipe to fourth fragment (view pager), but if i go back to the first fragmen

2条回答
  •  再見小時候
    2021-02-05 17:00

    public void onDestroyView() {
    super.onDestroyView();
    
    try {
        Fragment fragment = (getFragmentManager().findFragmentById(R.id.map_container));  
        FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
        ft.remove(fragment);
        ft.commit();
    } catch (Exception e) {
        e.printStackTrace();
    }
    

    }

提交回复
热议问题