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 getPrefDisplayLineNumber(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_DISPLAY_LINE_NUMBER, true);
}

From source file:Main.java

public static boolean getSilentMode(Context context) {
    SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
    return SP.getBoolean("silent_pref", false);
}

From source file:Main.java

public static boolean getVibrateMode(Context context) {
    SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
    return SP.getBoolean("vibrate_pref", true);
}

From source file:Main.java

public static boolean isIncludeAdult(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_INCLUDE_ADULT, false);
}

From source file:Main.java

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

From source file:Main.java

public static boolean getPrefMenlofont(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getBoolean(PREF_MENLO_FONT, true);
}

From source file:Main.java

public static boolean UseMetricSystem(Activity a) {
    SharedPreferences sp = a.getSharedPreferences(FILE_KEY, Activity.MODE_PRIVATE);
    return sp.getBoolean(METRIC_KEY, false);
}

From source file:Main.java

public static boolean getSharedBooleanPref(Context context, String key, boolean dValue) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getBoolean(key, dValue);
}

From source file:Main.java

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

From source file:Main.java

/**
 * read boolean value from preference memory
 *//*  w w  w. jav a  2s . com*/
public static boolean getBoolean(Context context, String key, boolean defValue) {
    if (context == null)
        return defValue;
    SharedPreferences settings = context.getSharedPreferences(PREF_NAME, 0);
    return settings.getBoolean(key, defValue);
}