Talking about the activity of Android

Source: Internet
Author: User

Said activity, we can be said to be familiar with no longer familiar with, first of all, first to a town floor map,

  

Personally think that Google's picture is better than any other life cycle diagram, say the various life cycle notes:

1:onstart (), activity is visible;

2:oncreate () executes only once in the life cycle;

3:onpause (), activity is in a translucent state, not operable;

4:onstop (), activity is not visible;

5: Most cleanup operations are best done in OnPause () and OnStop, and if you perform a thread operation in OnCreate (), it is best to clean up at OnDestroy ().

When we create a new activity open, the life cycle Goes OnCreate ()-onstart ()-onresume ();

After our home key, the life cycle OnPause ()-onstop ();

Onrestart ()-onstart ()-onresume () when we reopen from the background;

  

When we press back to return, the life cycle Goes OnPause ()-onstop ()-ondestroy ();

  

  

  

  

  

  

  

Talking about the activity of Android

Related Article

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.