MODE_MULTI_PROCESS
来源:互联网 发布:spearman相关系数 知乎 编辑:程序博客网 时间:2024/06/06 02:35
/**
* SharedPreference loading flag: when set, the file on disk will
* be checked for modification even if the shared preferences
* instance is already loaded in this process. This behavior is
* sometimes desired in cases where the application has multiple
* processes, all writing to the same SharedPreferences file.
* Generally there are better forms of communication between
* processes, though.
*
* <p>This was the legacy (but undocumented) behavior in and
* before Gingerbread (Android 2.3) and this flag is implied when
* targetting such releases. For applications targetting SDK
* versions <em>greater than</em> Android 2.3, this flag must be
* explicitly set if desired.
*
* @see #getSharedPreferences
*/
* SharedPreference loading flag: when set, the file on disk will
* be checked for modification even if the shared preferences
* instance is already loaded in this process. This behavior is
* sometimes desired in cases where the application has multiple
* processes, all writing to the same SharedPreferences file.
* Generally there are better forms of communication between
* processes, though.
*
* <p>This was the legacy (but undocumented) behavior in and
* before Gingerbread (Android 2.3) and this flag is implied when
* targetting such releases. For applications targetting SDK
* versions <em>greater than</em> Android 2.3, this flag must be
* explicitly set if desired.
*
* @see #getSharedPreferences
*/
public static final int MODE_MULTI_PROCESS = 0x0004;
看到settingManager在载入sharedPref时,getSharedPreferences()会使用这个标记,其实作用和C的violate有点像,
及该prefs在读入到内存以后,也有可能被其他的进程改变,那么,对与prefs的每次修改都要做出回应,适用于多进程。
这个行为在2.3以前是默认,后面要用必须显式的加上,估计是为了性能吧.
0 0
- MODE_MULTI_PROCESS
- Class类的isAssignableFrom(Class cls)方法
- Android清除本地数据缓存代码
- 单选框和复选框的属性使用
- 1019. General Palindromic Number (20)
- This version of the rendering library is more recent than your version of IntelliJ IDEA
- MODE_MULTI_PROCESS
- 2015校园招聘IBM上海的一道笔试题
- Hadoop Job的提交
- 1020. Tree Traversals (25)
- Hibernate没写保存方法自动保存
- 【Swift初见】Swift变量和常量
- 内存对齐与补齐
- eclipse项目重命名
- 在MacOS上安装md5sum