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