List of usage examples for android.content Context MODE_PRIVATE
int MODE_PRIVATE
To view the source code for android.content Context MODE_PRIVATE.
Click Source Link
From source file:Main.java
public static void cacheLineLength(Context context, int lineLen) { SharedPreferences sp = context.getSharedPreferences(CONFIG, Context.MODE_PRIVATE); sp.edit().putInt(KEY_LL, lineLen).commit(); }
From source file:Main.java
public static void putIpPort(Context context, String ip) { SharedPreferences preferences = context.getSharedPreferences(IP_PORT, Context.MODE_PRIVATE); preferences.edit().putString(CVALUE, ip).commit(); }
From source file:Main.java
public static void setIntProperty(Context context, String key, int value) { SharedPreferences.Editor editor = context.getSharedPreferences(DEFAULT_FILE_NAME, Context.MODE_PRIVATE) .edit();/*from www . ja v a 2s . c o m*/ editor.putInt(key, value); editor.commit(); }
From source file:Main.java
public static boolean judgeFirstIn(Context context) { SharedPreferences preferences = context.getSharedPreferences("isFirst", Context.MODE_PRIVATE); boolean isFirst = preferences.getBoolean("isFirst", true); int versionCode = preferences.getInt("versionCode", 1); if (isFirst || versionCode < getVersionCode(context)) { preferences.edit().putBoolean("isFirst", false).commit(); preferences.edit().putInt("versionCode", getVersionCode(context)).commit(); }/*from w w w .j a v a 2s . co m*/ // return isFirst; return false; }
From source file:Main.java
public static String getUserId(Context context) { SharedPreferences preferences = context.getSharedPreferences(USER_INFO, Context.MODE_PRIVATE); String userIcon = preferences.getString(USER_ID, ""); return userIcon; }
From source file:Main.java
public static boolean needShow(Context ct) { boolean b = false; if (ct != null) { SharedPreferences sp = ct.getSharedPreferences(KEY_P, Context.MODE_PRIVATE); if (sp != null) { b = sp.getBoolean(KEY_V, true); }//from w w w . j av a2s.c o m } return b; }
From source file:Main.java
public static void saveStringSharedPreference(Context context, String key, String value) { SharedPreferences sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCE_TAG, Context.MODE_PRIVATE); sharedPreferences.edit().putString(key, value).apply(); }
From source file:Main.java
public static long getLongPreferences(Context context, String name) { try {/*from w w w . j a v a 2 s . c om*/ return context.getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).getLong(name, 0); } catch (Exception e) { Log.e("datautils", e.getMessage()); remove(context, name); } return 0; }
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;//from w w w .j a v a 2 s.c om }
From source file:Main.java
/** * Deletes the logged athlete from the android shared preferences *//*from ww w. jav a 2 s . co m*/ public static void removeLoggedAthlete(Context context) { context.getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE).edit().remove(LOGGED_ATHLETE).commit(); }