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 getPhone(Context context) { SharedPreferences preferences = context.getSharedPreferences(SETTINGS, Context.MODE_PRIVATE); return preferences.getString(PHONE, ""); }
From source file:Main.java
private static String getPreferenceString(SharedPreferences sharedPref, Context context, int StrRes, String defValue) {//w ww . jav a 2 s.c o m return sharedPref.getString(context.getString(StrRes), defValue); }
From source file:Main.java
public static boolean hasBind(Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); String flag = sp.getString("bind_flag", ""); if ("ok".equalsIgnoreCase(flag)) { return true; }//from w w w . j ava 2s. com return false; }
From source file:Main.java
public static String readPrefernce(Context context, String fileName, String key, String defaultValue) { SharedPreferences preferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); return preferences.getString(key, defaultValue); }
From source file:Main.java
public static String getToken(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return sharedPreferences.getString("token_preference", ""); }
From source file:Main.java
public static String fetchStringSharePref(Context context, String key, String defaultValue) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getString(key, defaultValue); }
From source file:Main.java
public static String getStringFromCache(Context context, String key) { SharedPreferences sp = context.getSharedPreferences("config", Context.MODE_PRIVATE); String string = sp.getString(key, ""); return string; }
From source file:Main.java
public static String getAccountName(Context context) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return sharedPreferences.getString("account_name_preference", ""); }
From source file:Main.java
public static String getPassword(final Context context) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); return sp.getString(PREF_SAVED_PASSWORD, null); }
From source file:Main.java
public static String getFbUsername(Context context) { SharedPreferences fbInfo = context.getSharedPreferences(FB_VARIABLES, 0); String username = fbInfo.getString(FB_NAME, ""); if (username.isEmpty()) { return ""; }// w w w . j a v a 2 s. com return username; }