Android activity can be started in four ways to record and open activity traps of other applications. androidactivity

Source: Internet
Author: User

Android activity can be started in four ways to record and open activity traps of other applications. androidactivity

Android supports standard, singleTop, singleTask, and singleInstence.

 

Standard is the most common method to start an activity and the default method. When an activity is started, it will enter the stack top of the returned stack. The system does not care whether the same activity exists in the stack. The method is as follows.

SingleTop is used to determine whether the same activity exists at the top of the stack when the activity starts. If no activity exists, a new activity is created. Otherwise, no activity is created. Instead, use it directly.

When the singleTask method starts an activity, the system first determines whether there is an active instance in the stack. If there is no new instance, the stacks above the existing activity are all taken out of the stack.

When singleInstance is started, a new stack is created. When other programs access this activity and start this activity, the instance is also obtained. All applications access the same instance.

 

When accessing activity A with singleInstance Startup Mode from application B in the experiment, you must add it to AndroidManifest. xml of application.

 

 

<Activity android: name = "com. example. testandroid. BActivity" android: exported = "true">
</Activity>

 

 

 

Android: exported = "true" indicates that the activity can be opened by other applications.
 
Reference: http://www.cnblogs.com/lwbqqyumidi/p/3793440.html

Related Article

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.