Example usage for android.preference PreferenceManager getDefaultSharedPreferences

List of usage examples for android.preference PreferenceManager getDefaultSharedPreferences

Introduction

In this page you can find the example usage for android.preference PreferenceManager getDefaultSharedPreferences.

Prototype

public static SharedPreferences getDefaultSharedPreferences(Context context) 

Source Link

Document

Gets a SharedPreferences instance that points to the default file that is used by the preference framework in the given context.

Usage

From source file:Main.java

/**
 * check it is the first time enter into station list page
 *///from   w  w  w  . ja  v a  2 s.  c  om
public static boolean isFirstEnterStationList(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    boolean isFirstEnter = prefs.getBoolean(FM_IS_FIRST_ENTER_STATION_LIST, true);
    if (isFirstEnter) {
        SharedPreferences.Editor editor = prefs.edit();
        editor.putBoolean(FM_IS_FIRST_ENTER_STATION_LIST, false);
        editor.commit();
    }
    return isFirstEnter;
}

From source file:Main.java

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

From source file:Main.java

/**
 * Gets the stored account name/* www  .ja  v a2 s  .  co  m*/
 */
public static String GetAccountName(Context applicationContext) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);
    return prefs.getString("GDRIVE_ACCOUNT_NAME", "");
}

From source file:Main.java

/**
 * Gets the stored account name//w w w .  j a v a 2 s . co m
 */
public static String GetAccountName(Context applicationContext) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);
    return prefs.getString("GDOCS_ACCOUNT_NAME", "");

}

From source file:Main.java

/**
 * Retrieves the value of counter from preference manager. If no value exists, it will return
 * <code>0</code>./*ww  w.  j a  va 2 s  . c  o  m*/
 */
public static int getCounterFromPreference(Context context) {
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
    return pref.getInt(PREF_KEY_COUNTER, 0);
}

From source file:Main.java

/**
 * Retrieve the default shared preferences of the application.
 *
 * @return the default shared preferences.
 */// www. j  a v a2 s . c  o  m
private static SharedPreferences getSharedPreferences() {
    return PreferenceManager.getDefaultSharedPreferences(applicationContext);
}

From source file:Main.java

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

From source file:Main.java

/**
 * Gets the stored authToken, which may be expired
 *//* w  w w.j a va  2s . c o  m*/
public static String GetAuthToken(Context applicationContext) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);
    return prefs.getString("GDRIVE_AUTH_TOKEN", "");
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public static void setBeamUnlocked(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    prefs.edit().putInt(PREF_BEAM_STATE, BEAM_STATE_UNLOCKED).commit();
}

From source file:Main.java

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