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 savePosition(Context context, int positionY, int positionX) {
    PreferenceManager.getDefaultSharedPreferences(context).edit().putInt("fa_positionY", positionY).apply();
    PreferenceManager.getDefaultSharedPreferences(context).edit().putInt("fa_positionX", positionX).apply();
}

From source file:Main.java

private static int getIntPreference(Context context, String key, int defaultValue) {
    return PreferenceManager.getDefaultSharedPreferences(context).getInt(key, defaultValue);
}

From source file:Main.java

public static Map<String, ?> getAllPrefs(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getAll();
}

From source file:Main.java

public static long GetLongPref(Context c, String name, long defaultValue) {
    long pref = PreferenceManager.getDefaultSharedPreferences(c).getLong(name, defaultValue);

    return pref;/*from  ww w .  j a v  a2  s.c o m*/
}

From source file:Main.java

public static String getConfig(Context context, String key, String defaultValue) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(key, defaultValue);
}

From source file:Main.java

public static String getStringSetting(Context context, String key, String defaultValue) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(key, defaultValue);
}

From source file:Main.java

public static boolean canSendMessages(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("key_send_sms", false);
}

From source file:Main.java

public static boolean isDarkTheme(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("dark_theme", false);
}

From source file:Main.java

public static boolean isBackupData(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("backup_data", false);
}

From source file:Main.java

private static SharedPreferences getPref(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context);
}