Android Activity Life Cycle Overview

Source: Internet
Author: User

1. Website Introduction

2. Activity A Jump Acitvity B

A:onpause--b:oncreate---B:onstart, B:onresume---A:onsaveinstancestate

At this point, click the back key:

B:onpause--A:onrestart---A:onstart, A:onrusume---B:onstop

3. Activity A Jump Dialog activity B

A:onpause--B:oncreate-->b:onstart--and B:onresume--a:onsaveinstancestate

At this point, click the back key:

B:onpause--A:onresume--B:onstop-B:ondestory

4. System pop-up box such as "Low Battery"

No impact on current activity life cycle (Samsung mobile)

5. Suddenly call, SMS, lock screen, launch other apps (full screen), other apps (Dialog)

A:onpause--Onsaveinstancestate-OnStop

6. Press the back key and the home key to distinguish

If you press the back key at this point, the system returns to the desktop, followed by A:onpause, A:onstop, A:ondestroy.

If you press the home key (not the long Press), the system returns to the desktop and executes A:onpause-a:onstop in turn. Thus, the main difference between the back key and the home key is whether the OnDestroy will be executed.

At this point, if you press and hold the home button, different phones may pop up different content, the activity life cycle has not changed (measured by millet 2s, do not know whether the other phone will affect the activity life cycle).

Android Activity Life Cycle Overview

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.