我的應用程序在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