Share: The destruction activity of Android starter development

Source: Internet
Author: User

Use:

destroy, close page activity

If you open the next page and destroy this page, on the next page can not return to this page, each open The app will first show an app 's introduction map, or logo page, delay a few seconds into the application, after entering can no longer return to the Logo page, is to destroy the logo page finish ();

Method:

Finish (); Destroying activity

Activity name . Finish (); destroys the specified activity, equivalent to this

This.finish (); destroy this page activity

Activity name . Instance.finish (); destroy other pages ' activity on this page

usage 1: With the Return key, click the Back button to trigger ontouchevent

@Override public boolean ontouchevent (Motionevent event) {finish ();    return true; }

usage 2 : Destroying other pages

On the page that needs to be destroyed://define a static global variable instancepublic static mainactivity instance = null;//in oncreate instance = this; On the page where the destruction was performed: Mainactivity. Instance.finish (); Mainactivity was destroyed.

destruction of the use of activity can save memory! APP online Automation test tool:www.ineice.com


Share: The destruction activity of Android starter development

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.