2
如何在appcompact7 alertdialog中进行自定义验证? 我在alertdialog中有一些输入,所以当我点击肯定按钮时,我想验证条件是否为真,万一条件返回false,我只是想显示错误消息,对话框不应该被解雇。如何防止在Android的正面按钮点击时自动解除Appcompact AlertDialog?
试图this,没有帮助
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (true) {
// Do this and dissmiss
} else {
// Do not dismiss the dialog
errormsg.setVisibility(View.VISIBLE);
errormsg.setText("Error");
}
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();
不能在此改变在onStart,这上面的解决方案使用android.app.dialog我想使用appcompact – Veer3383