Android Development (26)--application

Source: Internet
Author: User

Application

 Packagecom.lgaoxiao.application;Importjava.util.LinkedList;Importjava.util.List;Importandroid.app.Activity;Importandroid.app.Application;/*** A class used to end all background activity * *@authorAdministrator *@see http://java--hhf.iteye.com/blog/1826880 *  */ Public classSysapplicationextendsApplication {//using lists to keep each activity is key    PrivateList<activity> mlist =NewLinkedlist<activity>(); //to implement a static object that is created every time you use the class without creating a new object    Private StaticSysapplication instance; //Construction Method    Privatesysapplication () {}//Instantiate once     Public synchronized Staticsysapplication getinstance () {if(NULL==instance) {Instance=Newsysapplication (); }        returninstance; }    //Add Activity     Public voidaddactivity (activity activity) {Mlist.add (activity); }    //close each activity in the list     Public voidexit () {Try {             for(Activity activity:mlist) {if(Activity! =NULL) Activity.finish (); }        } Catch(Exception e) {e.printstacktrace (); } finally{system.exit (0); }    }    //Kill Process     Public voidonlowmemory () {Super. Onlowmemory ();    System.GC (); }}

Android Development (26)--application

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.