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 boolean getMode(Context context) {
    SharedPreferences pref2 = PreferenceManager.getDefaultSharedPreferences(context);
    return pref2.getBoolean("AudioManagerMode", false);
}

From source file:Main.java

public static String getLogText(Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    return sp.getString("log_text", "");
}

From source file:Main.java

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

From source file:Main.java

public static String getIconPack(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getString(ICON_PACK, "");
}

From source file:Main.java

protected static SharedPreferences getSharedPreferences(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context);
}

From source file:Main.java

public static boolean getSilentMode(Context context) {
    SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
    return SP.getBoolean("silent_pref", false);
}

From source file:Main.java

public static String getArea(Context ctx) {

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(ctx);

    String area = preferences.getString("selectedArea", "");
    return area;//ww w  . ja  va2  s.c o m
}

From source file:Main.java

public static boolean getVibrateMode(Context context) {
    SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
    return SP.getBoolean("vibrate_pref", true);
}

From source file:Main.java

public static void remove(Context context, String key) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    prefs.edit().remove(key).apply();/*from w ww  .  j a v  a  2 s  .  c  o  m*/
}

From source file:Main.java

public static void clearLoginInfo(Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    SharedPreferences.Editor editor = sp.edit();
    editor.remove("account");
    editor.remove("password");
    editor.commit();//from  w w  w .j a  v a  2  s . c o  m
}