Java tutorial
//package com.java2s; import java.util.ArrayList; import android.app.Activity; public class Main { public static ArrayList<Activity> arrayList = new ArrayList<Activity>(); public static void finishOtherZctivity(Activity activity) { Activity act = null; int length = arrayList.size() - 1; for (int i = length; i >= 0; i--) { act = arrayList.get(i); if (act != null && act == activity) { act.finish(); arrayList.remove(i); } } } }