I tried to set the default value for a ListPreference but nothing shows up.
Can you check my code for any errors?
Thanks.
Truly, Emad
This is in the settings.xml file:
<PreferenceCategory android:title="Media:">
<CheckBoxPreference android:key="ChimeWhenMusicIsPlaying"
android:title="@string/ChimeWhenMusicIsPlayingTitle" android:summary="@string/ChimeWhenMusicIsPlayingSummary"
android:defaultValue="false" />
<ListPreference android:title="Chime Volume"
android:key="ChimeVolume" android:summary="Select volume for the chiming sound."
android:entries="@array/chimeVolumeLabels" android:entryValues="@array/chimeVolumeValues"
android:defaultValue="1" />
</PreferenceCategory>
This is in the arrays file:
<resources>
<string-array name="chimeVolumeLabels">
<item>Default</item>
<item>Soft</item>
<item>Medium</item>
<item>Loud</item>
</string-array>
<string-array name="chimeVolumeValues">
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
</resources>
I found that sometime I need to clear application data. Uninstall and reinstall the app. After that, everything works as expected.