My android learning experience 2 and android learning experience 2

Source: Internet
Author: User

My android learning experience 2 and android learning experience 2

Lifecycle of an activity in android

There are seven major cycles

OnCreat ();

OnStart ();

OnResume ();

OnPause ();

OnStop ();

OnRestart ();

OnDestory ();

OnCreat () is called when the activity is run for the first time, and onStart () is called on the interface. onResume () is called when the focus is obtained.

When the second activity is called, The onPause () of the first activity is called. When the second activity completely overwrites the first acticity

The onStop () of the first activity is called when the first activity is not reached. If the second activity does not completely overwrite the first activity, the first activity is not called.

OnStop (). The onRestart () method is called after the back key is fully overwritten. When the finish () method is called or the system automatically exits, onDestory () is called ()

 

If you have any questions, please leave a message in the comment area. Thank you.

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.