Codigami/CFAlertDialog

how to implement adding Edittext

Closed this issue · 1 comments

New Issue Checklist

Issue Info

Info Value
Platform Name e.g. Android
Platform Version e.g. 6.0
CFAlertDialog Version e.g. 2.1.1
Integration Method e.g. gradle / manually

Issue Description and Steps

how to implement adding Edittext and retrieve data to activity.

after some time searching

LayoutInflater inflater = this.getLayoutInflater();
        final View dialogView = inflater.inflate(R.layout.edittext_layout, null);
        CFAlertDialog.Builder builder = new CFAlertDialog.Builder(this)
                .setDialogStyle(CFAlertDialog.CFAlertStyle.NOTIFICATION)
                .setHeaderView(dialogView);


        builder.addButton("OK", -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
            hiddenNote = ((EditText) dialogView.findViewById(R.id.hiddenEdittext)).getText().toString();
        });
        builder.addButton("Cancel", -1, -1, CFAlertDialog.CFAlertActionStyle.DEFAULT, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (dialog, which) -> {
            dialog.dismiss();
        });
        builder.show();
    }

it works fine
thanks for nice library