Intent seven properties, activity start mode, the life cycle of screen switching, on-site protection--

Source: Internet
Author: User

---------------------------------Intent Seven Properties-------------------------------------

First class: Start, with ComponentName (Explicit), Action (implicit), Category (implicit).

The second type: the value, with data (implicit), Type (implicit), Extra (implicit, explicit).

Class III: Boot mode with flag.

---------------------------------------how activity is started---------------------------

Four-way start:

Standard
The default mode, which can be configured without writing. In this mode, a new instance will be created by default. Therefore, in this mode, you can have multiple identical instances, and also allow multiple identical activity overlays.

Singletop
There can be multiple instances, but multiple identical activity overlays are not allowed. That is, if the activity is at the top of the stack, the same activity is started, the new instance is not created, and its Onnewintent method is called.

Singletask
There is only one instance. When you launch him in the same application, if the activity does not exist, a new instance is created in the current task and, if present, the other activity on top of the task is destory off and the Onnewintent method is called.

If you start it in another application, a new task is created and started in that task Activity,singletask allows other activity to be stored in a task, that is, If I open a new activity in this Singletask instance, the new activity will still be in the task of the Singletask instance.

SingleInstance
There is only one instance, and this instance runs independently in a task, and this task is the only instance that does not allow any other activity to exist.

----------------------------------------the life cycle of the screen switching---------------------------------

OnPause ()->onstop ()->ondestroy ()->oncreate ()->onstart ()->onresume ()
------------------------------------on-site protection--------------------------------------

First, why to do on-site protection:
1, activity in the life cycle of the paused state or stoped state, the memory space tense, the system is likely to kill activity, if the user through the navigation and return to the activity just killed, the system can only create new activity, If the previous activity interface has user input information, such as user name and password, and in the new activity is not, this time need to do on-site protection

Intent seven properties, activity start mode, the life cycle of screen switching, on-site protection--

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.