// We need to have a non-null listener, otherwise we get null when
// we try to fetch the "Ok" button.
if (mDialogListener == null) {
mDialogListener = this;
}
AlertDialog dialog = new AlertDialog.Builder(mParent)
.setTitle(R.string.change_response_title)
.setIcon(android.R.drawable.ic_dialog_alert)
.setSingleChoiceItems(R.array.change_response_labels, whichEvents,
mListListener)
.setPositiveButton(android.R.string.ok, mDialogListener)
.setNegativeButton(android.R.string.cancel, null)
.show();
mAlertDialog = dialog;
if (whichEvents == -1) {
// Disable the "Ok" button until the user selects which events to
// delete.
Button ok = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
ok.setEnabled(false);
}