"Original" Logcat information demo activity life cycle

Source: Internet
Author: User

The interface is as follows: Note: This is in the phone, vertical screen state!

(i) 1 activity

/**
* 7 Methods
* Test the life cycle of 1 activity
*
* LogCat:
* 1.
* After startup: Call the following 3 methods in turn
* OnCreate
* OnStart
* Onresume
*
* Press the phone or simulator back button:
* OnPause
* OnStop
* OnDestroy
*
* 2.
* After startup: Call the following 3 methods in turn
* OnCreate
* OnStart
* Onresume
*
* Press the Phone home button:
* OnPause
* OnStop
*
* Then follow the procedure to enter:
* Onrestart
* OnStart
* Onresume
*
* Then press to return:
* OnPause
* OnStop
* Ondestory
*
* Press the Back button to exit the program, the program enters activity is shut down, the background continues to run
* Finish () method, let the program enter progress is killed, kill the process, the background is no longer running
* Press the back key and the finish () Method 2 ways, the activity life cycle is the same!
*
*/


(ii) 2 activity

/**
* LogCat:
* (i) only 7 methods are written in mainactivity
* 1.
* After startup: Call the following 3 methods in turn
* OnCreate
* OnStart
* Onresume
*
* Press to jump to the next screen:
* OnPause
* Grow Heap (frag case) to 13.002MB for 782816-byte allocation
* Grow Heap (frag case) to 15.932MB for 3131216-byte allocation
* OnStop
*
* Press the Back button: then go to run
* Onrestart
* OnStart
* Onresume
*
* Then press to return:
* OnPause
* OnStop
* Ondestory
*
*
* 2.
* After startup: Call the following 3 methods in turn
* OnCreate
* OnStart
* Onresume
*
* Press to jump to the next screen:
* OnPause
* Grow Heap (frag case) to 13.002MB for 782816-byte allocation
* Grow Heap (frag case) to 15.932MB for 3131216-byte allocation
* OnStop
*
* Press "Back to upper Interface": Then go to run
* OnCreate
* OnStart
* Onresume
*
* Then press to return:
* OnPause
* OnStop
* Ondestory
*
* Note: Call OnCreate to rebuild mainactivity after pressing "back to upper interface"
* Onrestart is called after pressing the back button, restart Mainactivity
*
* Here mainactivity and otheractivity relationship can be understood as the stack space--mainactivity first Enter and then exit,
* Otheractivity after otheractivity to exit before it is entered.
*
* (ii) write 7 methods in both Mainactivity and otheractivity
* 1.
* After startup: Call the following 3 methods in turn
* A.oncreate
* A.onstart
* A.onresume
*
* Press to jump to the next screen:
* A.onpause
* B.oncreate
* B.onstart
* B.onresume
* A.onstop
*
* Press the Back button: then go to run
* B.onpause
* A.onrestart
* A.onstart
* A.onresume
* B.onstop
* B.ondestroy
*
* Then press to return:
* A.onpause
* A.onstop
* A.ondestory
*
*
* 2.
* After startup: Call the following 3 methods in turn
* A.oncreate
* A.onstart
* A.onresume
*
* Press to jump to the next screen:
* A.onpause
* B.oncreate
* B.onstart
* B.onresume
* A.onstop
*
* Press "Back to upper Interface": Then go to run
* B.onpause
* A.oncreate
* A.onstart
* A.onresume
* B.onstop
*
* Then press to return:
* A.onpause
* B.onrestart
* B.onstart
* B.onresume
* A.onstop
* A.ondestory
*
* Then press to return:
* B.onpause
* A.onrestart
* A.onstart
* A.onresume
* B.onstop
* B.ondestroy
*
* Then press to return:
* A.onpause
* A.onstop
* A.ondestroy
*
*
* 3.
* After startup: Call the following 3 methods in turn
* A.oncreate
* A.onstart
* A.onresume
*
* Press to jump to the next screen:
* A.onpause
* B.oncreate
* B.onstart
* B.onresume
* A.onstop
*
* Press the Exit button in the Other.xml
* B.onpause
* A.onrestart
* A.onstart
* A.onresume
* B.onstop
* B.ondestroy
*
* Return to the Activity_main.xml interface and press the exit program
* A.onpause
* A.onstop
* A.ondestroy
*
*/

"Original" Logcat information demo activity 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.