getDefaultShared preferences和MODE_MULTI_PROCESS [英] getDefaultSharedPreferences and MODE_MULTI_PROCESS
问题描述
有没有设置由 getDefaultShared preferences检索到的preferences方式的任何方式(上下文)
到 MODE_MULTI_PROCESS
所以它可以在多个流程中使用?
Is there any way of setting the mode of the preferences retrieved by getDefaultSharedPreferences(Context)
to MODE_MULTI_PROCESS
so it can be used across multiple processes?
如果没有,可以通过 getDefaultShared preferences
使用preferences文件名进行检索和使用 getShared $ P $再次使用pferences(字符串名称,诠释模式)
设置 MODE_MULTI_PROCESS
If not, can the preferences file name used by getDefaultSharedPreferences
be retrieved and used again with getSharedPreferences(String name, int mode)
setting MODE_MULTI_PROCESS
?
最后,如果没有,如果这是可能的,什么是复制与 getDefaultShared preferences pviously定义的preferences $ P $的最佳方式(上下文)
来可与 MODE_MULTI_PROCESS
Finally if none if this is possible, what's the best way to copy the preferences previously defined with getDefaultSharedPreferences(Context)
to a new preference file that can be used with MODE_MULTI_PROCESS
?
推荐答案
你试过
setSharedPreferencesMode(Context.MODE_MULTI_PROCESS);
这篇关于getDefaultShared preferences和MODE_MULTI_PROCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!