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 getLiveType(Context context) { SharedPreferences preferences = context.getSharedPreferences(LIVE_TYPE, Context.MODE_PRIVATE); String type = preferences.getString(CVALUE, "0"); return type;// w ww . j a va 2 s . com }
From source file:Main.java
public static String getDeviceId(Context context) { SharedPreferences preferences = context.getSharedPreferences(DEVICE, Context.MODE_PRIVATE); String deviceid = preferences.getString(DEVICEID, "android"); return deviceid; }
From source file:Main.java
public static String getFromPreferences(String key, Context mContext) { SharedPreferences preferences = mContext.getSharedPreferences(TRACKER_PREFERENCES, Context.MODE_PRIVATE); return preferences.getString(key, null); }
From source file:Main.java
public static String getVersion(Context context) { SharedPreferences preferences = context.getSharedPreferences(VERSION, Context.MODE_PRIVATE); String version = preferences.getString(VERSION_KEY, "1"); return version; }
From source file:Main.java
public static String getString(Context context, String key, String defValue) { SharedPreferences sp = context.getApplicationContext().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); return sp.getString(key, defValue); }
From source file:Main.java
private static String getCacheMacAddress(Context context) { if (context == null) { return null; }// w w w .j av a2 s. c om SharedPreferences sharedPreferences = context.getSharedPreferences(MAK_KEK, Context.MODE_PRIVATE); return sharedPreferences.getString(MAK_VALUE, null); }
From source file:Main.java
/** * Pops the latest message from the messages and returns it. * /*from w w w . j av a 2 s.c o m*/ * @param context The application context. * @return The latest message. */ public static String popLastMessage(Context context) { SharedPreferences sp = context.getSharedPreferences("messages", Context.MODE_PRIVATE); String last = sp.getString("last", null); sp.edit().putString("last", null).commit(); return last; }
From source file:Main.java
public static String getDeviceCaption(@NonNull Context argContext) { SharedPreferences argSharedPreferences = PreferenceManager.getDefaultSharedPreferences(argContext); return argSharedPreferences.getString(deviceNameKey, getDeviceID()); }
From source file:Main.java
/** * Get the MVD id. Default is "mvd".//from w w w. ja v a 2 s . c o m * * @param context The application context * @return The id */ public static String getMvdId(Context context) { SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE); return prefs.getString("id", "mvd"); }
From source file:Main.java
public static String getLocalCache(Context ctx, String key) { if (ctx == null) { return null; }//from ww w . j a va 2 s . c om try { SharedPreferences sp = ctx.getSharedPreferences("LocalCache", Activity.MODE_PRIVATE); return sp.getString(key, null); } catch (Exception e) { e.printStackTrace(); } return null; }