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 get(Context context, String key, String defValue) { SharedPreferences preferences = context.getSharedPreferences(CONFIG_FILE_NAME, Context.MODE_PRIVATE); return preferences.getString(key, defValue); }
From source file:Main.java
/** * Return the accountName the app is using as the active Google Account. * * @param context Context used to lookup {@link SharedPreferences} the value is stored with. *//* w w w. j ava 2 s . co m*/ public static String getActiveAccountName(final Context context) { SharedPreferences sp = getSharedPreferences(context); return sp.getString(PREF_ACTIVE_ACCOUNT, null); }
From source file:Main.java
public static boolean checkPreferences(@NonNull final Context context) { final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); return !(sharedPreferences.getString("sNummer", "").length() < 5 || sharedPreferences.getString("RZLogin", "").length() < 3); }
From source file:Main.java
public static String getValue(Context context, String key, String defValue) { SharedPreferences sp = context.getSharedPreferences(SETTING, Context.MODE_PRIVATE); String value = sp.getString(key, defValue); return value; }
From source file:Main.java
public static String getString(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(key, Context.MODE_PRIVATE); String value;/* w w w. jav a2s . c o m*/ value = sp.getString(key, ""); return value; }
From source file:Main.java
public static String getPubMod(String contactID, Context context) { SharedPreferences prefs = context.getSharedPreferences(contactID, Context.MODE_PRIVATE); String pubMod = prefs.getString(PREF_PUBLIC_MOD, DEFAULT_PREF); return pubMod; }
From source file:Main.java
public static String getPubExp(String contactID, Context context) { SharedPreferences prefs = context.getSharedPreferences(contactID, Context.MODE_PRIVATE); String pubExp = prefs.getString(PREF_PUBLIC_EXP, DEFAULT_PREF); return pubExp; }
From source file:Main.java
private static String getUserAccount(Context context) { SharedPreferences sp = context.getSharedPreferences("user_account", Context.MODE_PRIVATE); String user_account = sp.getString("user_account", ""); return user_account; }
From source file:Main.java
public static String LoadAccountName(Context ctx) { String name = ""; try {// w w w. j a v a2 s.c om SharedPreferences savePref = ctx.getSharedPreferences(g_sUserPref, ctx.MODE_PRIVATE); name = savePref.getString("Name", ""); } catch (Exception ex) { ex.printStackTrace(); } return name; }
From source file:Main.java
public static String getPreferences(Context context, String key) { String data = ""; SharedPreferences pref = context.getSharedPreferences(context.getPackageName(), context.MODE_PRIVATE); data = pref.getString(key, ""); return data;//w ww .j a v a2 s . c om }