When I develop an Android application, how to exit this application? I try anything what I can do ,but I can't exit my application what I am developing. How to do this ? Any idea?
This my solution ,as folow,
public class SysApplication extends Application {
private List<Activity> mList = new LinkedList<Activity>();
private static SysApplication instance;
private SysApplication() {
}
public synchronized static SysApplication getInstance() {
if (null == instance) {
instance = new SysApplication();
}
return instance;
}
// When an activity is created ,excute this method ,addActivity(activity)
public void addActivity(Activity activity) {
mList.add(activity);
}
//When I want to exit this aplication ,excute this method ,exit()
public void exit() {
for (Activity activity : mList) {
activity.finish();
}
System.exit(0);
}
@Override
public void onLowMemory() {
super.onLowMemory();
System.gc();
}
}