getDefaultShared preferences和MODE_MULTI_PROCESS [英] getDefaultSharedPreferences and MODE_MULTI_PROCESS

查看:134
本文介绍了getDefaultShared preferences和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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆