Hi,
How can I create a dialog with each dialog item being a label and then a checkbox?
And when user click 'ok' to the dialog, I can tell in my code which on of the dialog item has been checked?
Thank you.
Hi,
How can I create a dialog with each dialog item being a label and then a checkbox?
And when user click 'ok' to the dialog, I can tell in my code which on of the dialog item has been checked?
Thank you.
You might be interested in RadioGroup. The Android API demos have an example of using it here.
Not quite a checkbox, but a radio group allows you to click on the radio button from the list, and keep track of which one was selected. I have used one to do what you described (although I used an Activity instead of a Dialog, and used android:theme="@android:style/Theme.Dialog"
in my manifest to make my pretend dialog activity -look- like a Dialog).
The biggest problem though, is that RadioGroup only allows you to choose -one- item. So if you want to be able to select multiple items, then it will not work.