Fragmentation: replaceFragment Error

Hi @YoKeyword

I have a Viewpager include: Fragment A, B, C, D A is a blank Fragment -> in A, loadRootFragment(Fragment E) -> in E, button click to replace(Fragment F, false); -> viewpager setCurrentItem(1) -> viewpager setCurrentItem(0). Fragment F come back When Fragment F come back, both onLazyInitView and onSupportVisible are still called in E

How to replace(Fragment F), then Fragment E is removed (onLazyInitView and onSupportVisible isn’t called in E)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

In FirstDetailFragment:

popTo(FirstHomeFragment,true, new Runnable(
   ()->loadRootFragment(cycleFragment)
)

or in ZhihuFirstFragment:

popToChild(FirstHomeFragment,true, new Runnable(
   ()->loadRootFragment(cycleFragment)
)