Android Life cycle

Source: Internet
Author: User

When the activity was first created,

When a dialog pops up, there is no change in the life cycle, still the same as before, because the dialog belongs to the activity

When jumping to other interfaces, OnPause and OnStop are triggered.

Jumping back to just the interface again will trigger Onstart,onresume, and Onpostresume

When the home button is pressed, trigger OnPause and OnStop, the life cycle and jump to the other interface, the same nature.

When the interface is destroyed, the lifetime of the Walk is Onpause,onstop,ondestroy, and more than the previous call to OnDestroy.

The difference between OnStop and OnPause:

When a normal dialog is created, both sides are not called

When an activity dialog is created, OnPause is called and OnStop is not called

OnPause when the activity part is not visible, it will be triggered

OnStop is triggered when the activity is completely invisible, and onstop is not invoked if the subject of the new activity is transparent

The difference between OnStart and Onrestart:

When activity is created, only calling OnStart will not call Onrestart.

The onstart is called every time the activity is never visible to be visible.

OnStart can be understood to be paired with OnStop.

CP Relationship

Onstart-onstop

Onresume-onpause

Life cycle in exceptional situations

Onsaveinstancestate is called only under exceptional circumstances, such as rotating the screen, the original activity is destroyed, and the onsaveinstancestate is called

Android Life cycle

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.