Android Activity life cycle diagram

Source: Internet
Author: User

The activity life cycle of Android is picked from the internet

650) this.width=650; "style=" Float:none; "title=" 3g121-2.jpg "src=" http://s3.51cto.com/wyfs02/M01/28/01/ Wkiol1n1xqrckvzjaadbwrxgwza227.jpg "alt=" Wkiol1n1xqrckvzjaadbwrxgwza227.jpg "/>

Event callback method The following 1-4 cannot be terminated.

1. OnCreate (): The first method that is called after the activity is started, often used for initialization of activity, such as creating view, binding data, or recovering information.

(? What information OnCreate can recover)

2. OnStart (): When activity is displayed on the screen, the method is called

3. Onrestart (): The method is called when activity enters the active state from the stopped state.

4.onResume (): This method is called when activity is able to interact with the user and accept user input. The activity at this time is at the top of the activity stack

(? not understand )

5.onPause (): can be terminated. The method is called when activity enters a paused state. Typically used to save persistent data or to free up resource usage

6.onStop (): can be terminated. when activity enters a stopped state, the method is called

7.onDestory (): can be terminated. the method is called before the activity is terminated, i.e. before it goes into an inactive state.

8.onSaveInstanceState (): non-terminating. The Android system calls this method before terminating the activity due to insufficient resources to hold the activity's state information for onrestoreinstancestate () or oncreate () recovery

9.onRestoreInstanceState (): non-terminating. restores onsaveinstancestate () saved activity state information, called before OnStart () and Onresume ( )

650) this.width=650; "style=" Float:none; "title=" 3g121-3.jpg "src=" http://s3.51cto.com/wyfs02/M00/28/01/ Wkiom1n1xtxybiq0aacmzlm-t8g726.jpg "alt=" Wkiom1n1xtxybiq0aacmzlm-t8g726.jpg "/>

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.