I am working on an android app where I have implemented preference activity. I want to set more than one default values for Multi Select Preferences, how should I do it?
I want to do it programatically and not via layout
I am working on an android app where I have implemented preference activity. I want to set more than one default values for Multi Select Preferences, how should I do it?
I want to do it programatically and not via layout
On
Multi select ListPreference comes natively with Android from API level 11. For more information on this please check:
http://developer.android.com/reference/android/preference/MultiSelectListPreference.html
And for example ,you can check this http://blog.350nice.com/wp/archives/240
On
MultiSelectListPreference comes natively with Android from API level 11.
setValues method is used to set default value to MultiSelectListPreference.
void setValues (Set<String> values)
Sets the value of the key. This should contain entries in getEntryValues()
For example mListPref.setValue(defaultValue);
Try using :
Here the defaultValue is the Set of the entry values which you wish to set as the default values.