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 spitFile(String outputfile, byte[] b) throws IOException { OutputStream os = context.openFileOutput(outputfile, Context.MODE_PRIVATE); os.write(b);/*from w ww .j a va2s .c om*/ os.close(); }
From source file:Main.java
static void setSetting(Context context, String prefName, String prefData) { SharedPreferences.Editor editPrefs = context .getSharedPreferences("com.ihelp101.xinsta", Context.MODE_PRIVATE).edit(); editPrefs.putString(prefName, prefData); editPrefs.commit();// w w w . j ava 2s . c om }
From source file:Main.java
public static void logout(Context context) { context.getSharedPreferences(LOGIN_PREFERENCE, Context.MODE_PRIVATE).edit() .putBoolean(PREFERENCE_AUTHORIZED_KEY, false).apply(); }
From source file:Main.java
static public String readSharePerf(String tag) { SharedPreferences pref = activity.getSharedPreferences(tag, Context.MODE_PRIVATE); String data = pref.getString(tag, ""); if (data.equalsIgnoreCase("")) return null; else/*from w ww. ja v a 2s. c o m*/ return data; }
From source file:Main.java
public static void setLong(Context context, String key, Long values) { if (sp == null) { sp = context.getSharedPreferences("config", Context.MODE_PRIVATE); }/*from ww w . j a v a 2 s .com*/ sp.edit().putLong(key, values).apply(); }
From source file:Main.java
public static void setString(Context context, String key, String value) { if (sp == null) { sp = context.getSharedPreferences("gjw", Context.MODE_PRIVATE); }/* w w w .ja va2s. c o m*/ sp.edit().putString(key, value).commit(); }
From source file:Main.java
public static void removeKey(String preName, Context context, String key) { SharedPreferences pre = context.getSharedPreferences(preName, Context.MODE_PRIVATE); Editor editor = pre.edit();// w ww. jav a 2 s . c o m editor.remove(key); editor.commit(); }
From source file:Main.java
public static void setTextSizePrefs(Context context, String key, int value) { SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); sp.edit().putInt(key, value).commit(); }
From source file:Main.java
public static void saveSp(Context ctx, String spName, String key, String value) { SharedPreferences sp = ctx.getSharedPreferences(spName, Context.MODE_PRIVATE); Editor editor = sp.edit();//from w ww . j a v a2 s. c o m editor.putString(key, value); editor.commit(); }
From source file:Main.java
public static String retrieveToken() { String TOKEN_FILE = "token"; SharedPreferences preferences = context.getSharedPreferences(TOKEN_FILE, Context.MODE_PRIVATE); if (preferences != null) return preferences.getString("token", null); else/* w w w . java2s . c om*/ return null; }