在Android的警告对话框不应排除 [英] alert dialog in android should not dismiss

查看:137
本文介绍了在Android的警告对话框不应排除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个应用程序,它有一个警告对话框在里面。

I am making an application and it has an Alert Dialog in it.

现在我检查了一些数据,我从AlertDialog editTexts对话框正面按钮OnClick方法得到,但该对话框总是解雇,如果我的数据来自的EditText领域得到正确与否。

Now i am checking some data I got from AlertDialog editTexts in dialog Positive button OnClick method but the dialog always dismiss if data i got from edittext fields is correct or not.

我们如何可以禁用此功能。

How can we disable this feature.

更新:

我刚开针code和确认从对话框中针code和onPositive点击我检查,以验证针codeS。

I am gettin Pin Code and Confirm Pin Code from the Dialog Box and in onPositive click i have checked to verify the pin codes.

现在如果引脚codeS那么匹配它调用dialog.dismiss(),如果不匹配则显示敬酒。

Now if the pin codes matches then it is calling dialog.dismiss() and if not matching then display a Toast.

但万一针code不匹配,它显示了我的消息,并关闭该对话框。

But in case of pin code not matched it displays me the message and dismiss the dialog.

我不希望出现这种情况是会发生。

I dont want that to be happen.

更多的更新:

有没有什么办法,我将禁用确定按钮,当数据被验证它将使正面按钮?

is there any way that i will disable the OK Button and when data is verified it will enable the positive Button??

请帮忙

推荐答案

帽。感谢您的帮助。通过你的指导我得知道我可以禁用警报对话框按钮。是!它可以禁用按钮。

Cap. Thanks for your help. through your guides i have got to know that i can disable the Alert Dialog Button. YES! its possible to disable the buttons.

答案是:

我们可以使用禁用按钮:

we can disable the button using:

  Button pos =  Dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
  pos.setEnabled(true);

这篇关于在Android的警告对话框不应排除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆