Android completely exits the application, android Application
Zookeeper
Customizes a class that inherits from the Application. Used to record the opened Activity.
Call ExitApplication. newInstance (). addActivity (this) in the onCreate method of each Activity class; Add the Activity class to the list.
Call ExitApplication. newInstance (). exit () when exiting; execute finish () cyclically ();
Public class ExitApplication extends Application {
Private static List <Activity> acList = new dynamic List <Activity> ();
Private static ExitApplication instance = null;
Private ExitApplication (){}
// Singleton Mode
Public static ExitApplication newInstance (){
If (null = instance ){
Instance = new ExitApplication ();
}
Return instance;
}
Public void addActivity (Activity ){
AcList. add ();
}
Public static void exit (){
For (Activity activity: acList ){
Activity. finish ();
}
System. exit (0 );
}
}