Java tutorial
//package com.java2s; import android.app.Activity; import java.util.Stack; public class Main { private static Stack<Activity> activityStack = new Stack<Activity>(); public static void finishAllActivity() { for (Activity activity : activityStack) { if (activity != null) { activity.finish(); } } activityStack.clear(); } }