fragment-backstack
What does FragmentManager and FragmentTransaction exactly do?
getFragmentManager() Return the FragmentManager for interacting with fragments associated with this activity. FragmentManager which is used to create transactions for adding, removing or replacing fragments. fragmentManager.beginTransaction(); Start a series of edit operations on the Fragments associated with this FragmentManager. The FragmentTransaction object which will be used. fragmentTransaction.replace(R.id.fragment_container, mFeedFragment); Replaces the current fragment with the mFeedFragment … Read more
Navigation popUpTo and PopUpToInclusive aren’t clearing the backstack
<action android:id=”@+id/action_login_to_emailLoginFragment” app:destination=”@id/emailLoginFragment” app:popEnterAnim=”@anim/slide_in_right” app:popExitAnim=”@anim/slide_out_right” app:popUpTo=”@+id/loginFragment” app:popUpToInclusive=”true”/> Your popUpTo is going back to the email login, and then popping it because of the inclusive. If you will change the popUpTo to your login fragment, it will be navigated back to, and popped as well because of the inclusive flag, which will result in your desired … Read more
Is this the right way to clean-up Fragment back stack when leaving a deeply nested stack?
Well there are a few ways to go about this depending on the intended behavior, but this link should give you all the best solutions and not surprisingly is from Dianne Hackborn http://groups.google.com/group/android-developers/browse_thread/thread/d2a5c203dad6ec42 Essentially you have the following options Use a name for your initial back stack state and use FragmentManager.popBackStack(String name, FragmentManager.POP_BACK_STACK_INCLUSIVE). Use FragmentManager.getBackStackEntryCount()/getBackStackEntryAt().getId() … Read more