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 getDownloadOFFSwitch(Context context, String modeName) {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    boolean ret = settings.getBoolean(modeName, true);
    return ret;/*  w  w  w  . j ava  2  s .  co m*/
}

From source file:Main.java

public static boolean getNotificationSwitch(Context context, String modeName) {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    boolean ret = settings.getBoolean(modeName, true);
    return ret;/*  w ww .  ja  va 2s  .  c  o m*/
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static Boolean IsFirstLogin(Context context) {
    SharedPreferences preferences = context.getSharedPreferences("FirstLogin", Context.MODE_PRIVATE);
    return preferences.getBoolean("Isfirst", false);
}

From source file:Main.java

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