Code example for AlertDialog

Methods: getButton

0
        super.showDialog(state);
 
        // Can't use onPrepareDialogBuilder for this as we want the dialog 
        // to be kept open on click 
        AlertDialog d = (AlertDialog) getDialog();
        Button defaultsButton = d.getButton(DialogInterface.BUTTON_NEUTRAL);
        defaultsButton.setOnClickListener(new View.OnClickListener() {
            @Override 
            public void onClick(View v) {
                mSeekBar.setProgress(mHw.getDefaultValue() - mMin);
            } 
        }); 
    } 
 
    @Override 
    protected void onDialogClosed(boolean positiveResult) {
        super.onDialogClosed(positiveResult);
 
        if (positiveResult) {
            // Store HW value in SharedPreferences object 
            SharedPreferences.Editor editor =