In my setting activity, after selecting a ListPreference to order the result list in ascending or descending, the selected vale does not appear in the ListPreference. Here is my code for this list preference. I have also attached a screenshot for this problem. Please let me know what is the problem and what was my mistake.
<ListPreference
android:title="@string/pref_calllog_sorting"
android:key="@string/pref_calllog_sorting_descending"
android:defaultValue="@string/pref_calllog_sorting_descending"
android:entryValues="@array/pref_calllog_sorting_values"
android:entries="@array/pref_calllog_sorting_options" />

By putting special string %s into summary attribute, you tell Android to show the selected entry.
Your XML will then be
<ListPreference
android:title="@string/pref_calllog_sorting"
android:key="@string/pref_calllog_sorting_descending"
android:defaultValue="@string/pref_calllog_sorting_descending"
android:entryValues="@array/pref_calllog_sorting_values"
android:entries="@array/pref_calllog_sorting_options"
android:summary="%s"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With