Example usage for android.content SharedPreferences getBoolean

List of usage examples for android.content SharedPreferences getBoolean

Introduction

In this page you can find the example usage for android.content SharedPreferences getBoolean.

Prototype

boolean getBoolean(String key, boolean defValue);

Source Link

Document

Retrieve a boolean value from the preferences.

Usage

From source file:Main.java

public static boolean getBoolean(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);

    return sp.getBoolean(key, false);
}

From source file:Main.java

public static boolean getCameraActive(Context context) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sd.getBoolean(CAMERA_ACTIVE, false);
}

From source file:Main.java

public static boolean getBooleanPreference(Context context, String preferenceName, String key) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(preferenceName, 0);
    return sharedPreferences.getBoolean(key, false);
}

From source file:Main.java

public static boolean getPreferenceBoolean(String key, boolean defaultVal) {
    SharedPreferences prefs = context.getSharedPreferences(context.getPackageName(), 0);
    return prefs.getBoolean(key, defaultVal);
}

From source file:Main.java

public static boolean getBoolean(Context context, String key) {
    SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE);
    return sp.getBoolean(key, false);
}

From source file:Main.java

public static Boolean getBoolean(Context context, String key, Boolean defaultBoolean) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sp.getBoolean(key, defaultBoolean);
}

From source file:Main.java

public static boolean getSp(Context context, String key, boolean defaultValue) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG_NAME, context.MODE_PRIVATE);
    return sp.getBoolean(key, defaultValue);
}

From source file:Main.java

public static boolean getBoolean(Context mContext, String key, boolean values) {
    SharedPreferences sp = mContext.getSharedPreferences(SHARE_NAME, Context.MODE_PRIVATE);
    return sp.getBoolean(key, values);
}

From source file:Main.java

public static boolean isFirstByTag(String tag, Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    boolean flag = sp.getBoolean(tag, true);
    return flag;/* ww  w .j a v  a  2  s .c om*/
}

From source file:Main.java

public static boolean getShowInterface(Context context) {
    SharedPreferences sp = context.getSharedPreferences("alumni", Activity.MODE_PRIVATE);
    return sp.getBoolean("showintro", false);
}