Ask you to switch between Android activity issues

Source: Internet
Author: User

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


For example, there are three activity, the first activity is the initial generation, there is a ListView, click on an item, go to Activity2,activity2 to accept the Activity1 pass over some of the data, with Putextra transmission data. Similarly, there is a ListView in Activity2, click on an item, generate a activity3, but also to receive 2 of the data passed over. The problem is, there is a column menu at the top of the interface, such as the generation of activity1, display 1, and then generate Activity2 when the display 1>2, generate activity3 when the 1>2>3, when the Activity3 interface, Click on the menu bar 2, how to achieve normal jump to the interface, that is, click on the activity1 item generated interface?
Since Activity2 accepts activity1 data, if you want to generate a new activity2, you want to get the data from Activity1, the problem is activity3 does not have this data.
I know that there is a method of finish (), directly back to the previous activity, but if there are multiple activity,finish () between the use of ...


Solving..

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


Create an Activity instance manager, such as a map<integer,activity>, to store an activity instance by number, but to return from multiple actvity You can then finish to the activity that you want to go back to.

============ Solution 2============


You think about showing the data in the activity and saving it locally. Read the local data every time you turn it back on. This is just my train of thought. No time to live.

============ Solution 3============


Since you have this requirement, I recommend that you use fragment to switch between Fragmentmanager (). BeginTransaction ().

Ask you to switch between Android activity issues

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.