Java tutorial
//package com.java2s; import android.app.Activity; import java.util.ArrayList; public class Main { private static ArrayList<Activity> activityList; public static void finishActivity(Activity... activity) { if ((activityList != null) && (activity != null)) { for (int i = 0; i < activity.length; i++) { Activity act = activity[i]; if (act == null) { return; } act.finish(); } } } }