The AlertDialog.Builder
itself does not contain a dismiss()
or cancel()
method.
It is a convenience class to help you create a Dialog, which DOES have access to those methods.
Here is an example:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
AlertDialog alert = builder.create();
alert.show();
You can then call the alert.cancel()
method on the alert (not the builder).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…