Checks if a Context is not null and is not finishing and returns true, otherwise false - Android android.content

Android examples for android.content:Context

Description

Checks if a Context is not null and is not finishing and returns true, otherwise false

Demo Code

import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;

public class Main{

    /**/*from   ww w  .  j a  v  a2  s. c  o  m*/
     * Checks if a Context is not null and is not finishing and returns true, otherwise false.
     */
    public static boolean isContextValid(Activity context) {

        if (context != null && !context.isFinishing()) {
            return true;
        }

        return false;
    }

}

Related Tutorials