views:

234

answers:

1

I'm using listpreference in my android app and getting my key values and all is well and works good (now that you guys have helped me) BUT - when my listpreference menus popup, they only contain a cancel button.

Let's say the user is choosing between red, blue, and green. When the listpreference dialog first pops-up, the dialog only shows a cancel button. Because of that, the dialog disappears as soon as the user selects their choice. I would like it so that when the user chooses their setting, they see the radio button get highlighted and then they go ahead and click the ok button...but I don't have an ok button and can't figure out why. Any help would be awesome...al

+2  A: 

You can clone and reimplement ListPreference to work the way you want, making your own custom Preference class as a result.

However, ListPreference is set up to only use a negative ("Cancel") button. As the source code says:

    /*
     * The typical interaction for list-based dialogs is to have
     * click-on-an-item dismiss the dialog instead of the user having to
     * press 'Ok'.
     */
CommonsWare