Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87079d44 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Allow calls to AlertDialog.getButton() before dialog is shown"

parents 4524cc64 a1e63319
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -146,9 +146,13 @@ 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
@@ -156,6 +160,8 @@ public class AlertDialog extends Dialog implements DialogInterface {
     * @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);
    }