I have a listpreference in my app which has an array with 5 possible
values.  However, the listpreference is not showing the drop-down next
to it to indicate it can be changed, although the entire list does get
shown when the user clicks on the name of the preference.  It is also
being updated correctly.  How can I get the drop-down to display?

This is preferences.xml
        <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
  xmlns:android="http://schemas.android.com/apk/res/android";>
    <CheckBoxPreference
      android:title="Show Count"
      android:key="showCount"
      android:summary="Select to show remaining tile count"
      android:defaultValue="true">
    </CheckBoxPreference>
    <CheckBoxPreference
      android:title="Start with random level"
      android:key="randomLevel"
      android:summary="Select to start with a random level"
      android:defaultValue="false" >
    </CheckBoxPreference>
    <ListPreference
      android:entries="@array/speedOptions"
      android:title="Speed"
      android:key="Speed"
      android:entryValues="@array/speed"
      android:summary="Normal"
      android:dialogTitle="Speed"
      android:defaultValue="5"
      android:selectable="true"
      android:enabled="true">
    </ListPreference>
</PreferenceScreen>

This is the preferences activity:
        public class MyPreferences extends PreferenceActivity
implements OnSharedPreferenceChangeListener {
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                addPreferencesFromResource(R.xml.preferences);
                ListPreference pref = (ListPreference) findPreference("Speed");
                pref.setSummary(pref.getEntry());

                SharedPreferences prefs
=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
                prefs.registerOnSharedPreferenceChangeListener(this);
        }

        public void onSharedPreferenceChanged(SharedPreferences prefs, String
key) {
                if (findPreference(key) instanceof ListPreference) {
                        ListPreference pref = (ListPreference) 
findPreference(key);
                        pref.setSummary(pref.getEntry());
                }
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to