Android-Learning Record (I. Life cycle)

Source: Internet
Author: User

Want to learn Android development, first of all to understand the life cycle of Android, although I hate this thing, but after a few days of learning to find that this thing must remember, rote!

This picture, the rest of the matter, first the middle line must be remembered, and understand what they are used for.

1.onCreate (Bundle savedinstancestate);

Typically used to initialize settings: 1, set the layout file to use for the activity 2, the button binding listener and other static settings operations

2.onStart ();

When the activity is visible and the user focus does not get interactive, the system calls

3.onRestart ();

When activity is stopped and then restarted, the system calls

4. Onresume ();

When activity is visible and the user's focus can interact, the system calls

5.onPause ();

Used to move from one activity to another activity, device into hibernation (screen locked), or dialog popup.

6.onStop ();

Called by the system when the activity is completely overwritten by the new activity is not visible

7.onDestroy ();

When the activity (user calls finish () or the system is destroyed by the system due to low memory) the system is called, (the entire life cycle is called only 1 times) to release the resources created in the OnCreate () method, such as the end thread, etc.

Anyway, probably this is the most commonly used, interested can create a project to run, to see each event is triggered under what circumstances, (create a project what ...)   I don't care about that. You can implement each method in the project, and then write in it: System.out.println (); Quick Writing is SYSO and then press the TAB key, I will kill to help you write good drops!!!!

Android-Learning Record (I. 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.