Release of activity

Source: Internet
Author: User

1. activitytwo. Finish ();

Call this method when your activity is completed or when the activity needs to be closed.
When you call this method, the system only removes the top activity from the stack and does not call the ondestory () method in time. The resources occupied by the ondestory () method are not released in time. Because the stack is removed, you will not find this activity when you click the "back" button on your phone;

2. activitytwo. ondestroy ();

The system destroys the memory occupied by the activity instance.
In the life cycle of an activity, the ondestory () method is the last step of its life, and the resource space is recycled. When re-entering this activity, you must re-create and execute the oncreate () method.

3. system. Exit (CODE );

This is to exit the entire application and target the entire application. If the code is 0, the system Exits normally;

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.