Four launchmodes of an Activity

Source: Internet
Author: User

09:42:21

Reprinted from: http://blog.csdn.net/liuhe688/article/details/6754323 #

This is the clearest article about launchMode.

Write your own things:

1. An application exits by pressing back and opens it again. At this time, the value of getTaskId (), that is, the Task ID, will change, :-). I didn't pay attention to it before;

2. For SingleTask, if you declare it again, all the Activity instances on the corresponding Activity will go out of the stack and change it to the top object of the stack;

3. singleInstance:

Open Activity (launchmode = singleInstance) in application B, press the Home Key to exit, open application A, and find that the Activity is the same Task ID.

Open Activity (launchmode = singleInstance) from A, press Home to exit, open application B, and then open Activity (launchmode = singleInstance) in A from B ), it is found that the Activity is still the same Task ID.

ActivityA enables ActivityB, ActivityB uses SingleInstance, and ActivityB opens ActivityC. It is found that ActivityA and ActivityC are in the same stack, and ActivityB is in another stack. When returning ActivityC to ActivityA, press and return, to ActivityB.

Download the test code. If you are interested, you can change the code by yourself:

Http://files.cnblogs.com/wlrhnh/4_lauchmode.zip

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.