List of usage examples for android.content Context getSharedPreferences
public abstract SharedPreferences getSharedPreferences(File file, @PreferencesMode int mode);
From source file:Main.java
public static void setClickCount(Context context, int count) { SharedPreferences sd = context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); SharedPreferences.Editor editor = sd.edit(); editor.putInt(CLICK_COUTNT, count);/* ww w.j ava 2 s . c o m*/ editor.commit(); }
From source file:Main.java
public static boolean getVersionCode(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(VERSION_S, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(VERSION_S_K, false); }
From source file:Main.java
public static void setStatusOfRenderResetSwitcher(Context context, boolean flag) { try {//from w w w . j av a2 s . c o m context.getSharedPreferences(context.getPackageName(), 1).edit() .putBoolean("reset_default_render", flag).commit(); return; } catch (Exception exception) { return; } }
From source file:Main.java
/** Return a properly configured SharedPreferences instance */ public static SharedPreferences getSharedPreferences(Context context, String prefsName) { return context.getSharedPreferences(prefsName, Context.MODE_PRIVATE); }
From source file:Main.java
public static Set<String> getStringSet(Context mContext, String key) { SharedPreferences pref = mContext.getSharedPreferences(AIO_SHARE_PREFS, Context.MODE_MULTI_PROCESS); return pref.getStringSet(key, null); }
From source file:Main.java
public static HashMap<String, String> restoreDistanceAndLocation(Context context) { SharedPreferences sharedPref = context.getSharedPreferences("DistanceAndLocation", Context.MODE_PRIVATE); String[] keyList = { "longitude", "latitude", "kmTravelled" }; HashMap<String, String> values = new HashMap<>(); for (String key : keyList) values.put(key, sharedPref.getString(key, null)); return values; }
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 String getZfbType(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(ZfbType, Context.MODE_PRIVATE); return sharedPreferences.getString(ZfbType_K, ""); }
From source file:Main.java
public static boolean isLogged(Context context) { SharedPreferences sharedPreferences = context.getSharedPreferences(SHERED_NAME, Context.MODE_PRIVATE); return sharedPreferences.getBoolean(SHARED_KEY_IS_LOGGED, false); }
From source file:Main.java
public static void saveSharedPreBoolean(Context context, String key, boolean value) { settings = context.getSharedPreferences(XML_Settings, 0); settings.edit().putBoolean(key, value).commit(); }