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

Commit a1e63319 authored by Alan Viverette's avatar Alan Viverette
Browse files

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

Change-Id: If0737ff53f3e500c2a946a18a753e279882965a2
parent 5436b0cf
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);
    }