Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;
import android.content.pm.ApplicationInfo;

public class Main {
    private static Boolean isDebuggable;

    /** Check if the app can be debugged or not */
    public static boolean isDebugable(Context context) {
        if (isDebuggable == null) {
            if (context == null) {
                throw new NullPointerException("Context should not be null the first time.");
            }
            isDebuggable = (0 != (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
        }
        return isDebuggable;
    }
}