Activity redirection in Android

Source: Internet
Author: User

I recently used android to write a shopping guideProgramThis program contains four activities A, B, C, and D. A is used to fill in the customer information when purchasing the product, after entering the information, click "trigger event" to jump to "B". "B" is used to display all product categories. select one of the product categories and jump to "C". The "C" interface is used to display the brief information of all products under this category, select a product to go to D. The details of the product are displayed in D, and you can enter the number of purchases in the interface. After you click OK on the D interface, you are required to directly return to interface A, and retain all the information when you left the interface last time ....

I directly used the startactivity method at the beginning. However, after the interface is returned, the previous data is gone .... I asked online, but someone gave me a solution. The solution is as follows:

When you jump from interface B to interface C, call Activity B's finish method to destroy B. Also, call the finish method to destroy C when C jumps to interface D, then, when D jumps to A, D is also destroyed, so that the program will jump directly to interface A, and the information in interface A can be retained ....

The principle of this method is to use the activity stack in the Android system. When you destroy all the activities on the activity to be displayed in the stack, Android will naturally display that activity ....

 

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.