getParentFragment returning null

后端 未结 4 1291
遥遥无期
遥遥无期 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条回答
  •  温柔的废话
    2020-12-01 18:16

    The one thing that helped is, when creating adapter use getChildFragmentManager().

    If you are not using adapter, just use getChildFragmentManager() when doing transactions.

    setTargetFragment() is not recommended, since it gives errors on moveState() of fragment(because fragments should be tied to FragmentManager)

提交回复
热议问题