【问题标题】:One can use getDefaultSharedPreferences and getSharedPreferences(nome,mode) in the same app? [duplicate]可以在同一个应用程序中使用 getDefaultSharedPreferences 和 getSharedPreferences(nome,mode) 吗? [复制]
【发布时间】:2015-04-22 09:45:11
【问题描述】:

我正在维护一个使用共享首选项的应用。

正常设置来自 getDefaultSharedPreferences。我想使用 getSharedPreferences 存储另一组首选项(用户会话信息,与其他设置完全无关)。

如果我这样做,是否有可能会干扰另一个?

【问题讨论】:

标签: android sharedpreferences


【解决方案1】:

如果我这样做,有没有可能干扰另一个?

不,没有这样的事情。它们存储在两个不同的 xml 文件中(除非您有幸猜到默认名称 context.getPackageName() + "_preferences")。

【讨论】:

    猜你喜欢
    • 2012-03-12
    • 2020-02-27
    • 2011-08-22
    • 1970-01-01
    • 2020-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多