Android-onpause ()

Source: Internet
Author: User

OnPause used to move from one activity to another activity, device into hibernation (screen locked), or dialog Popup

OnStop for invisible Activity (when a dialog pops up, the activity underneath is still visible, so onStop is not called at this time)

The difference can be seen from the following log logs:

1. When jumping from firstactivity to secondactivity

Firstacvity---> OnCreate
Firstacvity--->onstart
Firstacvity--->onresume
Firstacvity--->onPause
Secondactivity--->oncreate
Secondactivity--->onstart
Secondactivity--->onresume
Firstacvity--->onStop

Now add the Android:theme= "@android: Style/theme.dialog" to the seconedactivity attribute in Androidmainfest.xml, The seconedactivity will appear as a dialog box and will not cover the Firstacvity form.

The status output at this point is:

Firstacvity---> OnCreate
Firstacvity--->onstart
Firstacvity--->onresume
Firstacvity--->onPause
Secondactivity--->oncreate
Secondactivity--->onstart
Secondactivity--->onresume

The OnStop method is called less firstacvity than when it is completely obscured.

The following two cases will only trigger onpause without triggering onstop

1. A transparent activity that contains dialog appears

2. Press Poweroff to lock the screen

Shows a non-activity dialog that is not called OnPause and OnStop, because this dialog belongs to the activity

Android-onpause ()

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.