Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.your_dialog_file);
Button yourButton = dialog.findViewById(R.id.yourButton);
final EditText text = dialog.findViewById(R.id.yourTextEdit);
yourButton.setOnClickListener( {
public void onClick(View view) {
if ( ! (text.getText().toString.equals(""))) {
//go on here and dismiss dialog
}
});