question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

replaceFragment Error

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
YoKeywordcommented, Apr 10, 2017

In FirstDetailFragment:

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

or in ZhihuFirstFragment:

popToChild(FirstHomeFragment,true, new Runnable(
   ()->loadRootFragment(cycleFragment)
)
0reactions
HuuNguyen312commented, Apr 13, 2017

Thanks for your support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix fragmentTransaction.replace error and cannot be ...
'replace(int, android.app.fragment)' in 'android.app.fragmentTransaction' cannot be applied to. which is also. Error: ContactDetailFragment ...
Read more >
AppCompat 25.1.0 FragmentTransaction replace keeps ...
In AppCompat 25.1.0 when I replace a fragment, the previous fragment is still visible behind the new fragment. This code has worked for...
Read more >
Fragment transactions - Android Developers
Use replace() to replace an existing fragment in a container with an instance of a new fragment class that you provide. Calling replace()...
Read more >
Replace fragment tag with FragmentContainerView Causing ...
Replace fragment tag with FragmentContainerView Causing Runtime Error. Because it fails to find navigation controller in your activity class. You ...
Read more >
android.app.FragmentTransaction.replace java code examples
FragmentTransaction tx = fragmentManager.beginTransation(); tx.replace( R.id.fragment, new MyFragment() ).addToBackStack( "tag" ).commit();
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found