Code example for AlertDialog

Methods: dismiss, findViewById, getCurrentFocus, show

0
     * Hides, recreates, and shows the dialog. This can be used to handle configuration changes. 
     */ 
    public void reshow() { 
        String username = getUsername();
        String password = getPassword();
        int focusId = mDialog.getCurrentFocus().getId();
        mDialog.dismiss();
        createDialog(); 
        mDialog.show();
        if (username != null) {
            mUsernameView.setText(username);
        } 
        if (password != null) {
            mPasswordView.setText(password);
        } 
        if (focusId != 0) {
            mDialog.findViewById(focusId).requestFocus();
        } else { 
            mUsernameView.requestFocus();
        } 
    }