Android基础 BaseAppliction使用

Appliction 基础类 统一管理所有activity

    public class a extends Application {
    private static a b;
    private List a = new ArrayList();

    private a() {
    }

    public static a a() {
        if (b == null) {
            b = new a();
        }
        return b;
    }

    public void a(Activity activity) {
        this.a.add(activity);
    }

      //终止
    public void onTerminate() {
        super.onTerminate();
        for (Activity finish : this.a) {
            finish.finish();
        }
        Process.killProcess(Process.myPid());
    }
}

你可能感兴趣的:(Android基础 BaseAppliction使用)