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 应用程序中使用的共享首选项值?
可能是您无意中设置了此设置。
如果没有,请确保您正确存储数据并在之后提交数据,如下所示:
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this); p.edit().putString("myKey", "myValue"); p.edit().commit(); //No commit = no persitance