[英]Default value for the preference in the android application is not updating
In my preference xml I have: 在我的首选项xml中,我有:
<EditTextPreference
android:title="Location"
android:key="@string/pref_location_key"
android:defaultValue="689558"
android:inputType="text"
android:singleLine="true" />
So the default value for this preference supposed to be "689558", but when I run my app it looks like this: 因此,此首选项的默认值应该是“ 689558”,但是当我运行我的应用程序时,它看起来像这样:
In short, I have mysterious "94043" value instead of "689558". 简而言之,我的值是“ 94043”而不是“ 689558”。 Where I could make mistake?
我可能在哪里犯错?
Didn't you set your preference before? 您之前没有设定喜好吗? Try to delete the app data from settings/applications and reinstall your app.
尝试从设置/应用程序中删除应用程序数据,然后重新安装您的应用程序。 If you set the preference once it will remain the same independently from restart or reinstall.
如果您设置了首选项,它将独立于重启或重新安装而保持不变。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.