I have a simple CheckBoxPreference "blargh" defined in an XML file. I
want to programatically set its default value with code like this
which does not work
in subclass of PreferenceActivity:
public void onCreate() {
addPreferencesFromResource(R.xml.prefs);
findPreference("blargh").setDefaultValue(true);
}
I would expect with code above that the first time the activity is
displayed, the checkbox preference is checked due to true set as the
default value. This isn't the case, it is unchecked.
(In code above I force default value to true but in reality this is a
computed value).
I made sure to uninstall the app before reinstalling it to ensure
first run conditions.
What I'm doing wrong ? What's the correct way to dynamically set a
default value for a preference loaded from XML ?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en