-
- package com.main.server;
- import java.util.LinkedList;
- import java.util.List;
- import com.main.data.UserDao;
- import android.app.Activity;
- import android.app.Application;
- public class MyApplication extends Application {
- private List<Activity> activityList = new LinkedList<Activity>();
- private static MyApplication application;
- public MyApplication(){
- }
- public static MyApplication getInstance(){
- if(null == application){
- application = new MyApplication();
- }
- return application;
- }
- public void addActivity(Activity activity){
- activityList.add(activity);
- }
- public void exit(){
- UserDao.userDao.close();
- for(Activity a : activityList){
- a.finish();
- }
- }
- }
- MyApplication.getInstance().addActivity(this);每打开个Activity就掉用
转载于:https://www.cnblogs.com/CaptainLin/p/3617814.html