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 quary(Context context, String fileName, String key) { SharedPreferences sharedPreferences = context.getSharedPreferences(fileName, context.MODE_APPEND); return sharedPreferences.getString(key, null); }
From source file:Main.java
public static ArrayList<String> getArrayListValue(Context context, String name) { ArrayList<String> list = new ArrayList<String>(); SharedPreferences prefs = getPref(context, DEF_PREF_NAME); String json = prefs.getString(name, null); if (json != null) { try {//from w w w .ja v a2 s . c om JSONArray array = new JSONArray(json); for (int i = 0; i < array.length(); i++) { String url = array.optString(i); list.add(url); } } catch (JSONException e) { } } return list; }
From source file:Main.java
public static String getDeviceId(Context context) { SharedPreferences mPrefs = context.getSharedPreferences(DEVICE_ID_FILE, Context.MODE_PRIVATE); return mPrefs.getString(DEVICE_ID_KEY, null); }
From source file:Main.java
private static String getPersistedData(Context context, String defaultLanguage) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getString(SELECTED_LANGUAGE, defaultLanguage); }
From source file:Main.java
/** * Gets the stored account name/*from w w w . j a va 2 s. c o m*/ */ public static String getAccountName(Context applicationContext) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(applicationContext); return prefs.getString("GDOCS_ACCOUNT_NAME", ""); }
From source file:Main.java
private static String getPreferenceString(SharedPreferences sharedPref, Context context, int StrRes, int StrResDefValue) { return sharedPref.getString(context.getString(StrRes), context.getString(StrResDefValue)); }
From source file:Main.java
public static String getPlusProfileId(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getString(PREF_PLUS_PROFILE_ID, null); }
From source file:Main.java
public static String getCipher(Context context) { String aes = null;// www .ja v a 2s . co m if (context != null) { SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context); aes = settings.getString("cipher", ""); } return aes; }
From source file:Main.java
public static boolean isLoginFirst(Context context) { SharedPreferences fbInfo = context.getSharedPreferences(FB_VARIABLES, 0); String loginfirst = fbInfo.getString(IS_FIRST_TIME, "yes"); if (loginfirst.equals("yes")) { return true; }/*from w w w. j av a2s .c o m*/ return false; }
From source file:Main.java
public static String getString(Context context, String key) { SharedPreferences sp = context.getSharedPreferences("configdata", Context.MODE_PRIVATE); String result = sp.getString(key, null); return result; }