The definitions of your arrays should look like:
<string-array name="entries">
<item>Red</item>
<item>Blue</item>
<item>Green</item>
<item>Black</item>
</string-array>
<string-array name="values">
<item>#FF0000</item>
<item>#0000FF</item>
<item>#00FF00</item>
<item>#000000</item>
</string-array>
In addition, I'd remove these lines from the preferences ...
android:negativeButtonText="@null"
android:positiveButtonText="@null"
... and, more important: set a default value that is part of the list.
<ListPreference
android:defaultValue="Red"
android:entries="@array/preferencebackground"
android:entryValues="@array/preferencebackgroundvalues"
android:key="example_list1"
android:title="@string/preferencebackground" />
Assuming you stored the arrays in a file called arrays.xml
and the preferences file is well-formed as well, it should work without any issues.
p.s. of course it's better to use a string reference instead of the hard-coded Red
and color references instead of #FF0000
etc.