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 isRestoreData(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("restore_data", false);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

private static SharedPreferences getSharedPref(Activity activity) {
    return PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
}

From source file:Main.java

public static SharedPreferences getPrefrences(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context);
}

From source file:Main.java

public static void setRun(Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    SharedPreferences.Editor editor = sp.edit();
    editor.putBoolean("firstRun", true);
    editor.commit();//www  . ja  va 2s. c  om
}

From source file:Main.java

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

From source file:Main.java

public static boolean useAdvancedCapturing(Context context) {
    return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("captureAdvanced", true);
}

From source file:Main.java

public static boolean isLogin(Context context) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
    String account = sp.getString("account", null);
    return account != null;
}

From source file:Main.java

public static long getWaitSeconds(Context context) {
    String v = PreferenceManager.getDefaultSharedPreferences(context).getString("key_wait_seconds", "10");
    try {/*from w ww . j  a va2  s .co m*/
        return Long.parseLong(v) * 1000;
    } catch (Exception ex) {
        ex.printStackTrace();
        return 10 * 1000;
    }
}