This is more of a UX issue than a real problem but it would be nice if I can fix it.
I’m creating a single choice AlertDialog similar to the image…

The code I use to create it is…
private void createGuideViewChooserDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select Guide View");
builder.setSingleChoiceItems(guideViewChooserDialogItems, currentGuideView, this);
guideViewChooserDialog = builder.create();
guideViewChooserDialog.show();
}
…so basically I use an int called currentGuideView to set which radio-button is shown as selected and my Activity implements DialogInterface.OnClickListener hence using this in the call to setSingleChoiceItems(...).
The onClick(...) listener does some simple things based on the item selected then calls guideViewChooserDialog.cancel().
The problem I’m having is when I touch one of the list items, the item is briefly highlighted to acknowledge the touch BUT the AlertDialog disappears without showing a change of selected radio-button.
Everything works fine and my onClick(...) listener gets which item was touched but it’s just a bit disconcerting that the dialog disappears without seeing the radio-button selection change.
I’m testing this on an HTC Desire w/ Android v2.2. Is this planned behaviour or a bug in either v2.2 or the HTC implementation of it? Is there anything I can (or should) do so the selected item’s radio-button is correctly shown as selected before the dialog disappears?
The dialog is getting dimissed immediately because that’s what you must have set it to do in your
DialogInterface.CnClickListener. If you don’t want it to be dimissed, then add a button for the user to click “ok”, confirming their radio choice and then dismiss the dialog.