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
private static SharedPreferences prefs(Context context) { return context.getSharedPreferences(ACCOUNT_PREFS, Context.MODE_PRIVATE); }
From source file:Main.java
public static void putBoolean(Context context, String key, boolean value) { SharedPreferences sp = context.getSharedPreferences("atguigu", Context.MODE_PRIVATE); sp.edit().putBoolean(key, value).commit(); }
From source file:Main.java
public static void remove(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sp.edit(); editor.remove(key).commit();//from w w w. j a v a2 s . c o m }
From source file:Main.java
public static int getUserId(Context context) { int userId = 0; if (context != null) { SharedPreferences sp = context.getSharedPreferences("userInfo", Context.MODE_PRIVATE); userId = sp.getInt("USERID", 0); }//from ww w. j a va 2 s. c o m return userId; }
From source file:Main.java
private static SharedPreferences getPrefs(Context context) { return context.getSharedPreferences(GENERAL_PREFS_ID, Context.MODE_PRIVATE); }
From source file:Main.java
public static boolean getBoolean(String fileName, Context context, String keyId, boolean defaultValue) { SharedPreferences sharedPreferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(keyId, defaultValue); }
From source file:Main.java
public static boolean contains(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE); return sp.contains(key); }
From source file:Main.java
public static void setFloat(Context ctx, String key, Float value) { SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); sp.edit().clear();/*from w w w.j a v a 2 s. c o m*/ sp.edit().putFloat(key, value).commit(); }
From source file:Main.java
public static int getTextSizePrefs(Context context, String key) { SharedPreferences sp = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE); return sp.getInt(key, 2); }
From source file:Main.java
public static int getInt(Context ctx, String key, int defaultValue) { SharedPreferences sp = ctx.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); return sp.getInt(key, defaultValue); }