List of usage examples for android.content SharedPreferences getString
@Nullable String getString(String key, @Nullable String defValue);
From source file:Main.java
public static String getFromSp(Context ctx, String spName, String key) { SharedPreferences sp = ctx.getSharedPreferences(spName, Context.MODE_PRIVATE); return sp.getString(key, null); }
From source file:Main.java
public static void appendSettingString(final SharedPreferences sp, final String key, final String append) { String oldValue = sp.getString(key, ""); sp.edit().putString(key, oldValue + append).commit(); }
From source file:Main.java
public static String getString(Context ctx, String key, String defValue) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); return sp.getString(key, defValue); }
From source file:Main.java
public static String getString(String key, String defValue, Context ctx) { SharedPreferences sp = ctx.getSharedPreferences("config", Context.MODE_PRIVATE); return sp.getString(key, defValue); }
From source file:Main.java
public static String getPrefTheme(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getString(PREF_THEME, "Default"); }
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
public static String getPreferredSortSetting(Context context) { SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); return pref.getString("sort", "popular"); }
From source file:Main.java
/** * read string from preference memory//w w w . ja va2 s. c o m */ public static String getString(Context context, String key, String defValue) { if (context == null) return defValue; SharedPreferences settings = context.getSharedPreferences(PREF_NAME, 0); return settings.getString(key, defValue); }
From source file:Main.java
public static String getString(Context context, final String key, final String defaultValue) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); return prefs.getString(key, defaultValue); }
From source file:Main.java
public static String getSettingStringValue(Context context, String path, String key) { SharedPreferences settingInfo = context.getSharedPreferences(path, 0); String value = settingInfo.getString(key, "0"); return value; }