Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个 Android 应用程序,并且有一个带有偏好的帐户验证器。但是当我添加两个我类型的帐户时,它们之间会共享偏好。如何定义首选项,以便可以为每个帐户分别设置?
提前致谢!
普热梅克
请勿Preferences用于此目的!
Preferences
你应该使用AccountManager.setUserData()和AccountManager.getUserData()存储你的东西;这使您的设置安全(AccountManager正在存储它)并且您正在传递Account,因此一切都正确匹配,并且在用户删除帐户时完成了所有簿记。
AccountManager.setUserData()
AccountManager.getUserData()
AccountManager
Account