Ask Android veteran guide.

Source: Internet
Author: User

============ Problem Description ============


I wrote multiple fragment in a acitivity. There are several layers of fragment in the jump, but I press the back button on the phone to turn off the current activity, that is, fragment all have been turned off. I want to implement the return to the previous fragment when pressing fallback: Can I ask if it is possible? How to do it?

============ Solution 1============


Before call commit (), however, your might want to call Addtobackstack (), in order to add the transaction to a back Stac K of fragment transactions. This return stack was managed by the activity and allows the user to the previous fragment state, by pressing the B Ack button.

Ask Android veteran guide.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.