1

This question has already been asked here it works like a charm. Application's minSdkVersion is 14, but now I have to provide support for sdkVersion 9 (Android 2.3.3 Gingerbread). The solution does not work for API Level 9. Documentation also recommends using '%s'. Is there any nice way of handling it in older/legacy version of android. Here is my ListPreference code.

<ListPreference
    android:defaultValue="option_1"
    android:dialogTitle="@string/options_dialog_title"
    android:entries="@array/option_entries"
    android:entryValues="@array/options_values"
    android:key="algo"
    android:title="@string/pref_title"
    android:summary="%s"/>

The output appears like this.

enter image description here

I am looking for something nice and easy. There exist a lengthy way of doing it by getting the preference.

Preference prefListOption = (Preference)findPreference("algo");

and calling setSummary function something like this

prefListOption.setSummary(value);//user selected value
Community
  • 1
  • 1
A.B.
  • 1,554
  • 1
  • 14
  • 21

0 Answers0