我现在AlertDialog中,有三个EditViet.他们三个都不能为空.
然后他们三个我都用了setError的方法提示.
但是每次我按了确定,然后对话框就消失了.这个问题怎么解决.
我想在其中一个为空的时候,点了确定,对话框还不消失,应该怎么解决呢?

解决方案 »

  1.   


     new AlertDialog.Builder(this).setPositiveButton("a",
                    new DialogInterface.OnClickListener() {                    @Override
                        public void onClick(DialogInterface dialog, int which) {
                            try {
                                Field f = dialog.getClass().getSuperclass()
                                        .getDeclaredField("mShowing");
                                f.setAccessible(true);
                                f.set(dialog, false);// 不关闭
                                // f.set(dialog, true);关闭
                            }
                            catch(Exception e) {
                                // TODO: handle exception
                            }
                        }
                    }).show();