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 saveFile(Context context, String name, String text) throws IOException { FileOutputStream fos = context.openFileOutput(name, Context.MODE_PRIVATE); fos.write(text.getBytes());/*w ww . j av a 2 s .c o m*/ fos.close(); }
From source file:Main.java
private static void saveUID(Context context, String userid) { SharedPreferences.Editor localEditor = context.getSharedPreferences(XL_PREFERENCES, Context.MODE_PRIVATE) .edit();/*from ww w. j a va 2 s. c o m*/ localEditor.putString("userid", userid); localEditor.commit(); }
From source file:Main.java
public static String getSharedPreferences(Context ct, String key, String name) { if (key == null) { return null; }//from w w w.j a v a 2 s.c om SharedPreferences sPreferences = ct.getSharedPreferences(name, Context.MODE_PRIVATE); String value = sPreferences.getString(key, null); return value; }
From source file:Main.java
public static String getString(Context context, String key, String defaultString) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); return sp.getString(key, defaultString); }
From source file:Main.java
public static void clearDataAsOffLine(Context context) { SharedPreferences preferences = context.getSharedPreferences(PRFERENCE_NAME_SYT, Context.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.clear();//from w w w. j a v a 2 s .co m editor.commit(); // CacheFileUtil.reSetCacheDir(); }
From source file:Main.java
public static int getInt(Context context, String key, int defValue) { SharedPreferences sp = context.getApplicationContext().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); return sp.getInt(key, defValue); }
From source file:Main.java
public static String getStringPref(Context context, String name, String def) { SharedPreferences prefs = context.getSharedPreferences(APPLICATION_NAME, Context.MODE_PRIVATE); return prefs.getString(name, def); }
From source file:Main.java
public static void putBoolean(Context context, String name, boolean value) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(name, value);/*from w w w . ja v a 2s . c o m*/ editor.commit(); }
From source file:Main.java
public static boolean getBoolean(Context context, String key, boolean defaultValue) { SharedPreferences sharedPreferences = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); boolean userGuide = sharedPreferences.getBoolean(key, defaultValue); return userGuide; }
From source file:Main.java
public static void putString(Context context, String name, String value) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(name, value);//from w ww. ja va 2 s . c om editor.commit(); }