0

为什么在设备重新启动时会删除我的 Android 应用程序中使用的共享首选项值?

4

1 回答 1

1

可能是您无意中设置了此设置。

在此处输入图像描述

如果没有,请确保您正确存储数据并在之后提交数据,如下所示:

SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
                  p.edit().putString("myKey", "myValue");
                  p.edit().commit(); //No commit = no persitance 
于 2012-09-29T11:11:54.753 回答