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 setPlusProfileId(final Context context, final String profileId) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putString(PREF_PLUS_PROFILE_ID, profileId).commit();
}

From source file:Main.java

private static void setChosenAccountName(final Context context, final String accountName) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.edit().putString(PREF_CHOSEN_ACCOUNT, accountName).commit();
}

From source file:Main.java

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

From source file:Main.java

public static String getWiFiConfigStatus(final Context context) {
    final SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString(PREF_WIFI_AP_CONFIG, null);
}

From source file:Main.java

public static void registerOnSharedPreferenceChangeListener(final Context context,
        SharedPreferences.OnSharedPreferenceChangeListener listener) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.registerOnSharedPreferenceChangeListener(listener);
}

From source file:Main.java

public static void unregisterOnSharedPreferenceChangeListener(final Context context,
        SharedPreferences.OnSharedPreferenceChangeListener listener) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    sp.unregisterOnSharedPreferenceChangeListener(listener);
}

From source file:Main.java

public static String getToken(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(TOKEN, null);
}

From source file:Main.java

public static String getMirror(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(MIRROR, null);
}

From source file:Main.java

public static String getDevice(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(DEVICE, null);
}

From source file:Main.java

public static void setToken(Context context, String token) {
    PreferenceManager.getDefaultSharedPreferences(context).edit().putString(TOKEN, token).apply();
}