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