Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.os.Build; public class Main { public static boolean isAlive(Activity activity) { return activity != null && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) && !activity.isFinishing(); } }