I have the following AlertDialog:
AlertDialogBuilder dialogBuilder = new AlertDialogBuilder(mContext);
dialogBuilder.setTitle(R.string.title);
dialogBuilder.setMessage(mContext.getString(R.string.message));
dialogBuilder.setPositiveButton(R.string.positive, new MyOnClickListener);
dialogBuilder.setNegativeButton(R.string.negative, new MyOnClickListener);
dialogBuilder.show();
with this ClickListener
public static class MyOnClickListener {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}
I would expect the dialog to be closed, when clicking on either of the buttons, but the dialog stays open instead.
Where am I going wrong or how can I fix this?
