Android getSupportFragmentManager NULL pointer exception in Fragment

后端 未结 1 859
闹比i
闹比i 2021-01-18 13:24

i\'m trying to display new fragment with TabBar and View Pager after click on the Navigation drawer item.

Problem is that newly created Fragment is causing NULL poin

相关标签:
1条回答
  • change:

    mAdapter = new TabsPagerAdapter(getActivity().getSupportFragmentManager())
    

    to:

     mAdapter = new TabsPagerAdapter(getChildFragmentManager())
    

    when you are using fragment inside another fragment you must use ChildFragmentManager not FragmentManager.

    0 讨论(0)
提交回复
热议问题