I'm trying to create a PreferenceActicity.
I need that on of my preferences will be of type MultiSelectedListPreference.
I found this code on the internet:
<MultiSelectListPreference
android:dialogTitle="@string/mode_repeat"
android:key="mode_repeat"
android:summary=""
android:title="@string/mode_repeat"
android:entries="@array/weekdays"
android:entryValues="@array/weekdays_values"
android:defaultValue="@array/empty_array"
/>
The problem is I'm getting the entries and entryValues in runtime.
I'm building the ArrayList while my app is running, the question is how can I set my ArrayList as the entries and as the entryValues?
Do I need to create an empty xml file, which I will re-write during the building of my list?
You wouldn't be able to change the xml in runtime. The solution for your problem is to use the methods
setEntries()andsetEntryValues()from theMultiSelectListPreferenceclass.Here's a basic code snippet:
Hope this helps.