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

public static void markWelcomeDone(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_WELCOME_DONE, true).commit();
}

From source file:Main.java

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

From source file:Main.java

public static void setBleStatus(final Context context, boolean status) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putBoolean(PREF_BLE_ENABLED, status).commit();
}

From source file:Main.java

public static void setCurrentOwnCloudAccount(Context context, String name) {
    SharedPreferences.Editor appPrefs = PreferenceManager.getDefaultSharedPreferences(context).edit();
    appPrefs.putString("select_oc_account", name);
    appPrefs.commit();// ww w.  ja  v a2  s  .  c o  m
}

From source file:Main.java

public static void SetAccountName(Context applicationContext, String accountName) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);
    SharedPreferences.Editor editor = prefs.edit();

    editor.putString("GDRIVE_ACCOUNT_NAME", accountName);
    editor.apply();/*from   w  ww .  j a  v  a 2s  .  c o  m*/
}

From source file:Main.java

public static void SetAccountName(Context applicationContext, String accountName) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext);
    SharedPreferences.Editor editor = prefs.edit();

    editor.putString("GDRIVE_ACCOUNT_NAME", accountName);
    editor.commit();/*  w w w . j a  v a 2  s  . c o  m*/
}

From source file:Main.java

public static long getLastSyncAttemptedTime(final Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getLong(PREF_LAST_SYNC_ATTEMPTED, 0L);
}

From source file:Main.java

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

From source file:Main.java

/**
 * Called when first time play FM.//  w  w w .  j a  v  a2s.  co  m
 * @param context The context
 */
public static void setIsFirstTimePlayFm(Context context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putBoolean(FM_IS_FIRST_TIME_PLAY, false);
    editor.commit();
}

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);
}