📅  最后修改于: 2022-03-11 14:52:36.383000             🧑  作者: Mango
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
}
});