Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; import android.app.Activity; public class Main { public static List<Activity> allA = new ArrayList<Activity>(); public static void finishAllNoMainActivity() { for (Activity activity : allA) { if (!activity.getClass().getSimpleName().equals("Activity_Main")) { activity.finish(); } } } }