Life cycle of activity

Source: Internet
Author: User

1. The life cycle under normal circumstances

  • When the Activity is onStop or onPause, If the memory is not enough , it will be killed by the system and then re- onCreate

  • When the activity is on Stop , if the user navigates back to the activity, the on Start method is called

  • onPause and onStop can not do too heavy recycling work

2. life cycle in exceptional circumstances

  

  • Resource-related configuration changes cause Activity to be killed and recreated

      • activity window to save data window Then entrust him with the top container to save the data top container is generally a Viewgroup, In general it may be decorview, The last top-level container notifies its child elements to hold the data

      • do not want the system resource configuration to be To kill activityactivityconfigchange properties
    • Insufficient system resources lead to being killed
      •   

        Priority order : foreground activity > visible but not foreground activty > background activity

Life cycle of activity

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.