summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alan Viverette <alanv@google.com> 2013-12-10 02:44:37 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-12-10 02:44:37 +0000
commit87079d44f1aaed6b11e08c2893a429f775db0054 (patch)
tree83fd1903f1e8134f53abdd08f1360894e352e092
parent4524cc649affd5e83393ca07d5315fa09c617087 (diff)
parenta1e63319428c5713e89f67a7297feeec34c51a8d (diff)
Merge "Allow calls to AlertDialog.getButton() before dialog is shown"
-rw-r--r--core/java/android/app/AlertDialog.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/app/AlertDialog.java b/core/java/android/app/AlertDialog.java
index 2fd3cc8a49bf..b963ff2400e2 100644
--- a/core/java/android/app/AlertDialog.java
+++ b/core/java/android/app/AlertDialog.java
@@ -146,19 +146,25 @@ public class AlertDialog extends Dialog implements DialogInterface {
}
/**
- * Gets one of the buttons used in the dialog.
+ * Gets one of the buttons used in the dialog. Returns null if the specified
+ * button does not exist in the dialog.
* <p>
- * If a button does not exist in the dialog, null will be returned.
- *
+ * Prior to API 20, this function could only be called after the dialog was
+ * shown. In later versions, this function may be called at any time;
+ * however, calling this function locks in various attributes including
+ * buttons and icons.
+ *
* @param whichButton The identifier of the button that should be returned.
* For example, this can be
* {@link DialogInterface#BUTTON_POSITIVE}.
* @return The button from the dialog, or null if a button does not exist.
*/
public Button getButton(int whichButton) {
+ // Superclass handles re-entrance and multiple calls.
+ dispatchOnCreate(null);
return mAlert.getButton(whichButton);
}
-
+
/**
* Gets the list view used in the dialog.
*