Clear a Fragment in the Fragment rollback stack and clear the fragment rollback
Stack exit method:
GetActivity (). getsuppfrfragmentmanager (). popBackStackImmediate (CreateOneFragment. class. getName (), FragmentManager. POP_BACK_STACK_INCLUSIVE );
That is, the Fragment of all (including itself) above the Tag CreateOneFragment is displayed.
PopBackStackImmediate (name, flag );
The second parameter can only be 0 or 1 (pop_back_stack_random SIVE );
When the first parameter is null,
When the second parameter is 0:
The top fragment in the rollback stack is displayed.
As tested, the number of fragment in the rollback stack is reduced by one.
When the second parameter is 1:
The fragment of all rollback Stacks is displayed.
As tested, the number of fragment in the rollback Stack has changed to 0.
When the first parameter is not empty,
Based on the value of the second parameter, if it is flag = 0, all the above statuses will pop up;
If the flag is set to pop_back_stack_sive Sive, all the above statuses will pop up.
Ps: Method of stack entry
FragmentManager fragmentManager = getFragmentManager();FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();String name = fragment.getClass().getName();fragmentTransaction.replace(R.id.container, fragment).addToBackStack(nameForBackstackstate).commit();