I try to use MultiSelectListPreference in my android project.
I defined all settings as you can see:
<MultiSelectListPreference
android:key="key1"
android:title="title"
android:dialogTitle="title"
android:summary="dsfsdfsf"
android:entries="@array/entries"
android:entryValues="@array/entryValues"
android:persistent="true"
android:defaultValue="@array/defaults"/>
In strings.xml:
<string-array name="entries">
<item>Entry1</item>
<item>Entry2</item>
<item>Entry3</item>
</string-array>
<string-array name="entryValues">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="defaults" />
I get the Error message:
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Set at android.app.SharedPreferencesImpl.getStringSet(SharedPreferencesImpl.java:232)
What did i do wrong?
I solved it now. The code is correct. It was the data in the background. As soon as i deleted all data of the app including the cache, All works very well.