Requirements Scenario:
The following scenario is encountered in development:
1. Create Fragment A display. The structure of this stack is:
1
2. Create Fragment B and display. From bottom to top, the structure of the stack is:
2.Fragment B
1.Fragment A
3. Create Fragment C and display. From bottom to top, the structure of the stack is:
3.Fragment C
2.Fragment B
1.Fragment A
So, how do I jump from Fragment C to Fragment A at once?
implementation:
When you enter the stack, use the method
Passed in a parameter name, which is a fregment, and is used below.
Code:
Fragmentmanager Fragmentmanager == fragmentmanager.begintransaction (); = Fragment.getclass (). GetName (); Fragmenttransaction.replace (R.id.container, Fragment). Addtobackstack (Nameforbackstackstate). commit ();
To do this when it pops up:
Fragmentmanager.popbackstackimmediate (FragmentA.class.getName (), Fragmentmanager.pop_back_stack_ INCLUSIVE);
The second parameter of this method
Pop_back_stack_inclusive
Indicates that this pop-up behavior is a one-time out-of-stack "specified name" for all Fragment above Fragment.
Reference:
Http://www.cnblogs.com/qixing/p/4015262.html
Android Development (fragment) uses pop_back_stack_inclusive to jump to the bottom of the stack once. ACTIVITY-like adoption of flag_activity_clear_top