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 isUsersFirstNoteCreate(String username, Context context) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_FILENAME, 0);
    if (sharedPreferences.getBoolean(username + "_first_notecreate_flag", true)) {
        return true;
    }//from w w w . j  a  v  a  2s  .c om
    return false;
}

From source file:Main.java

public static boolean isUsersFirstMarkerClick(String username, Context context) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_FILENAME, 0);
    if (sharedPreferences.getBoolean(username + "_first_markerclick_flag", true)) {
        return true;
    }// ww w.  java  2s .c o  m
    return false;
}

From source file:Main.java

/**
 * check it is the first time to use Fm//  w  w  w. j  a  va2s  .  co m
 */
public static boolean isFirstTimePlayFm(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    boolean isFirstTime = prefs.getBoolean(FM_IS_FIRST_TIME_PLAY, true);
    return isFirstTime;
}

From source file:Main.java

public static boolean isUsersFirstLogin(String username, Context context) {
    SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_FILENAME, 0);
    if (sharedPreferences.getBoolean(username + "_first_login_flag", true)) {
        return true;
    }//  w w  w . jav  a2s . com
    return false;
}

From source file:Main.java

public static boolean getUpdatesNotificationEnabled(Context context) {
    SharedPreferences settings = context.getSharedPreferences(BCB_UPDATES_SHARED_PREF, Context.MODE_PRIVATE);
    return settings.getBoolean(BCB_UPDATE_NOTIFICATION_STATE, false);
}

From source file:Main.java

public static boolean isFirst(Context context) {
    SharedPreferences preferences = context.getSharedPreferences(APP_START_FIRST, Context.MODE_PRIVATE);
    boolean isFirst = preferences.getBoolean(APP_START_KEY, true);
    if (isFirst) {
        preferences.edit().putBoolean(APP_START_KEY, false).commit();
    }//from  www  .j  a v a 2s.co  m
    return isFirst;
}

From source file:Main.java

public static boolean getScheduleUpdated(Context context) {
    SharedPreferences settings = context.getSharedPreferences(BCB_UPDATES_SHARED_PREF, Context.MODE_PRIVATE);
    return settings.getBoolean(BCB_UPDATE_AVAILABLE, false);
}

From source file:Main.java

/**
 * This method check's the status of the visibility status bar.
 * /*from   ww w .  j a  v  a  2 s .  c o m*/
 * @param activity
 *            context of the application
 * @return Returns visibility of the status bar which was checked/unchecked
 *         by the user at the preferences.
 */
public static boolean checkStatusbarVisibility(Activity activity) {
    // Get the app's shared preferences
    SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(activity);
    return appPreferences.getBoolean("check_visbilityStatusbar", false);
}

From source file:Main.java

/**
 * Test if user hasn't save a preference yet.
 * @param context/*from w  w  w . jav  a 2s .  c o m*/
 * @return
 */
public static boolean isEmptySavedMunicipality(Context context) {
    SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFS_FILE, Context.MODE_PRIVATE);
    return prefs.getBoolean("isEmptySavedMunicipality", true);
}

From source file:Main.java

public static boolean needShow(Context ct) {
    boolean b = false;
    if (ct != null) {
        SharedPreferences sp = ct.getSharedPreferences(KEY_P, Context.MODE_PRIVATE);
        if (sp != null) {
            b = sp.getBoolean(KEY_V, true);
        }//from   ww w.j  a va 2s .c  om
    }
    return b;
}