Just a quick question: I just found out that
new AlertDialog.Builder(this) .setTitle("Hi") .setMessage("Some text. Did you read it?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {
works well on my device. Passing a null value as DialogInterface.OnClickListener simply rejects the dialog. I wanted to ask if this is legal or can cause problems, for example, on older Android devices / versions? I did not find anything in the documentation.
I have never done this yet, but it saves some code and makes sense, in my opinion. So far, I have always created an OnClickListener to reject the dialog. It does not seem to be necessary.
source share