public class ActivityConllection {
//创建Activity的集合
public static ArrayList<Activity> activities = new ArrayList<>();
//添加Activity
public static void addActivity(Activity activity){
activities.add(activity);
}
//删除Activity
public static void removeActivity(Activity activity){
activities.remove(activity);
}
//销毁所有activity
public static void finishAll(){
for (Activity activity: activities) {
if (activity.isFinishing()){
activity.finish();
}
}
//清除activity集合
activities.clear();
}
}
android Activity管理类
于 2019-04-08 14:27:02 首次发布