I'd like to have a dialog box which prompts the user to select from
various checkboxes, then confirm "Ok" or "Cancel". I have this
working, but my only issue is the dialog always retains the previous
checkbox selection state from the last time the dialog was shown. I'd
like to always force the checkboxes to be unchecked (false) every
time. Is there a way to accomplish this?

protected Dialog onCreateDialog(int id) {
        switch (id)         {
        case DIALOG_OPTION:
            return new AlertDialog.Builder(MyApp.this)
            .setTitle(R.string.select_option_title)
            .setMultiChoiceItems(R.array.select_option,
                    null,
                    new DialogInterface.OnMultiChoiceClickListener() {
                        public void onClick(DialogInterface dialog,
int whichButton, boolean isChecked) {
                            /* Do whatever with checked buttons */
                        }
                    })
            .setPositiveButton("OK", new
DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int
whichButton) {
                        /* User clicked Yes so do some stuff */
                        /* Is there a way to reset the checked buttons state
to false from here? */
                }
            })
            .setNegativeButton("Cancel", new
DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int
whichButton) {
                    /* User clicked No so do some stuff */
                    /* Is there a way to reset the checked buttons
state to false from here? */
                }
            })
           .create();
     }
     return null;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to