开发者

How to display defaultValues the first time a PreferenceActivity is started?

I've defined my preferences in an xml file, preferences.xml. I've also got a SettingsWindow class which extends PreferenceActivity. I've set the android:defaultValue attribute on my preferences in the xml file but they don't appear the first time the app is launched. How do I load the default values defined in the xml file int开发者_运维问答o the SettingsWindow the first time the activity is launched?


Figured out what's going on. I had defined my preferences.xml file and associated PreferenceActivity without specifying defaults and ran that in the emulator. Later on, I added the defaultValue tags to the xml file. When I deployed to the emulator, it wasn't the first time the preferences had been loaded so the defaultValues were skipped. Deleting the app's data and uninstalling\reinstalling the app fixed the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜