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