Activity
一.退出所有Activity:
1.记录所有新增的Activity
1)新建ActivityCollector类
public class ActivityCollector { public static LinkedList<Activity> activities = new LinkedList<Activity>(); public static void addActivity(Activity activity) { activities.add(activity); } public static void removeActivity(Activity activity) { activities.remove(activity); } public static void finishAll() { for(Activity activity:activities) { if(!activity.isFinishing()) { activity.finish(); } } } }
2)
![](https://i-blog.csdnimg.cn/blog_migrate/876f6f25674262ae21e59c41b2821f7e.jpeg)