Example usage for android.content Context getSharedPreferences

List of usage examples for android.content Context getSharedPreferences

Introduction

In this page you can find the example usage for android.content Context getSharedPreferences.

Prototype

public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);

Source Link

Document

Retrieve and hold the contents of the preferences file, returning a SharedPreferences through which you can retrieve and modify its values.

Usage

From source file:Main.java

public static long getDownloadId(Context context) {
    SharedPreferences pref = context.getSharedPreferences(PREFERENCE_NAME, 0);
    return pref.getLong(CONFIG_DOWNLOAD_ID, 0);
}

From source file:Main.java

public static boolean getNotiDoNotShowFlag(Context context) {
    SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    return sd.getBoolean(DO_NOT_SHOW_FLAG, true);

}

From source file:Main.java

public static void clear(Context context) {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    editor.clear().commit();/*from ww  w  .java  2  s .c o  m*/
}

From source file:Main.java

public static boolean getThemeIcons(Context context) {
    SharedPreferences sp = context.getSharedPreferences(ALMOSTNEXUS_PREFERENCES, Context.MODE_PRIVATE);
    boolean newD = sp.getBoolean("themeIcons", true);
    return newD;/*from  w ww  . ja  v a2  s  .  c o  m*/
}

From source file:Main.java

private static SharedPreferences getSharePreference(Context context) {
    return context.getSharedPreferences(context.getPackageName() + "_preferences", Context.MODE_MULTI_PROCESS);
}

From source file:Main.java

public static boolean getWebviewHelpStatus(Context context) {
    SharedPreferences sp = context.getSharedPreferences("webview_help", Activity.MODE_PRIVATE);
    boolean ret = sp.getBoolean("webview_help", false);
    return ret;//from   w  w w .  j  a v  a2s  .co m
}

From source file:Main.java

/**
 * Helper function to get the shared prefs
 * @param context Context used to get the prefs
 *//*w  w  w .  j a v a  2s. c o m*/
private static SharedPreferences getPreferences(Context context) {
    return context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
}

From source file:Main.java

public static int lineLength(Context context) {
    SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE);
    return sp.getInt(KEY_LL, DEFAULT_LINE_LENGTH);
}

From source file:Main.java

public static boolean getPosterStatus(Context context) {
    SharedPreferences sp = context.getSharedPreferences("recommend_poster", Activity.MODE_PRIVATE);
    boolean ret = sp.getBoolean("poster_status", true);
    return ret;/*from   w  ww . j a v  a2  s  . c  o m*/
}

From source file:Main.java

public static boolean getPosterHelpStatus(Context context) {
    SharedPreferences sp = context.getSharedPreferences("poster_help", Activity.MODE_PRIVATE);
    boolean ret = sp.getBoolean("poster_help", false);
    return ret;//from  ww w  .  j av  a 2  s .com
}