我的应用程序在SharedPreferences
中存储简单设置,它工作正常。 但是,对于一个下载我的应用程序的人有问题。 SharedPreferences
中的设置在关闭和重新加载应用程序之间正在丢失。保存在SharedPreferences中的用户设置在重新加载应用程序之间删除或丢失
他的手机某处是否存在权限问题,阻止了会话之间的数据保存?
有没有人遇到过这个问题,或知道为什么会发生这种情况? 我很难调试它,我不知道从哪里开始。
// I'm using SharedPreferences Like so:
prefs = getSharedPreferences(this.getString(R.string.prefs_name), 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("accounts", accounts);
editor.commit();
//retrieving stored information like:
SharedPreferences prefs = getSharedPreferences(this.getString(R.string.prefs_name), 0);
String accounts = prefs.getString("accounts","[]");
你使用的是DefaultSharedPreferences?如果没有,你确定你使用的字符串键在使用之间是否相同?没有代码片段就很难知道你做错了什么。 – 2011-05-10 20:08:02
嘿,不只是SharedPreferences,我使用相同的密钥,应用程序适用于数千人,只是这一个人。依靠这些信息的应用程序的其余部分功能完美,直到他关闭应用程序。 – Rob 2011-05-10 20:12:13
它可能是一个存储空间问题? – OceanBlue 2011-05-10 20:18:47