Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import java.util.Iterator;
import java.util.List;

import android.app.Activity;

public class Main {
    public static List<Activity> mActivityList = new ArrayList<Activity>();

    public static void finishAllActivity(Activity excludeActivity) {
        if (mActivityList.size() > 0) {
            if (excludeActivity != null) {
                mActivityList.remove(excludeActivity);
            }
            Iterator<Activity> it = mActivityList.iterator();
            while (it.hasNext()) {
                Activity activity = it.next();
                if (!activity.isFinishing()) {
                    activity.finish();
                }
            }
        }
    }

    public static void finishAllActivity() {
        if (mActivityList.size() > 0) {
            Iterator<Activity> it = mActivityList.iterator();
            while (it.hasNext()) {
                Activity activity = it.next();
                if (!activity.isFinishing()) {
                    activity.finish();
                }
            }
        }
    }
}