I'm using AlertDialog.Builder to build my dialog, it has an EditText which is necessary to be filled and I want to prevent closing the dialog while it is not. In the positive button's onClickListener I can check if the editText is filled or not but I don't know how to prevent closing...
builder.setPositiveButton("title", new DialogInterface.OnClickListener(){
@Override
public void onClick(DialogInterface dialog, int which) {
if(...){
//can close
}else{
//prevent closing
}
}
})
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…