getParentFragment returning null

后端 未结 4 1297
遥遥无期
遥遥无期 2020-12-01 17:41

I have a Fragment that has a FrameLayout. This first fragment (A) loads inside its Framelayout another fragment (B). When I call getParentFra

4条回答
  •  旧时难觅i
    2020-12-01 18:25

    In my case, although my fragmentA was nested in fragmentB,but I still get null after call getParentFragment in FragmentA. Finally I found that I should use getChildFragmentManager rather than getFragmentManager in FragmentB.

    check this What is difference between getSupportFragmentManager() and getChildFragmentManager()?

提交回复
热议问题