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("7Yan", context.MODE_PRIVATE);
    return sp.getBoolean(key, false);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean getMode(Context context) {
    SharedPreferences pref2 = PreferenceManager.getDefaultSharedPreferences(context);
    return pref2.getBoolean("AudioManagerMode", false);
}

From source file:Main.java

public static boolean getLoginState(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    return prefs.getBoolean(STATE_LOGIN, false);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * Gets the sound preferences/*  w  ww . ja  v  a2s . co  m*/
 * 
 * @param context
 * @return
 */
public static boolean getSound(Context context) {
    SharedPreferences settings = context.getSharedPreferences(PREFS_NAME, 0);
    return settings.getBoolean(PREF_SOUND, true);
}