不能检查,如果对话框显示 [英] Can't check if dialog is showing

查看:161
本文介绍了不能检查,如果对话框显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,一个对话框打开每次收到一个文本的时间。我希望它不会打开一个,如果有一个已经打开。我试图检查,如果一个是通过使用isShowing()开放的,但我不断收到方法isShowing()是undefinded该类型AlertDialog.Builder。这里是坏code的部分。任何帮助将是对,现在这么甜的权利。

 公共类珀普preply延伸活动{
AlertDialog.Builder alertbox;
AlertDialog.Builder警报;
@覆盖
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    // prepare警告框
    alertbox.isShowing();
    alertbox =新AlertDialog.Builder(本);


解决方案

有是关于 AlertDialog.Builder 类没有isShowing()方法。有一个关于对话框类,但是。

<一个href=\"http://developer.android.com/reference/android/app/AlertDialog.Builder.html\">AlertDialog.Builder

对话框

这是 AlertDialog.Builder 被用来创建一个 AlertDialog 。一旦你有一个实例 AlertDialog ,就可以判断它是否仍然由然后在其上调用isShowing()显示。

So a dialog is opened every time a text is received. I want it to not open one if there is one already open. I was trying to check if one was open by using isShowing() but I keep getting the method isShowing() is undefinded for the type AlertDialog.Builder. Here is the section of bad code. Any help would be so sweet right about now.

public class PopUpReply extends Activity{
AlertDialog.Builder alertbox;
AlertDialog.Builder alert;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // prepare the alert box
    alertbox.isShowing();
    alertbox = new AlertDialog.Builder(this);

解决方案

There is no isShowing() method on the AlertDialog.Builder class. There is one on the Dialog class though.

AlertDialog.Builder

Dialog

An AlertDialog.Builder is used to create an AlertDialog. Once you have an instance of an AlertDialog, you can determine whether or not it is still showing by then calling isShowing() on it.

这篇关于不能检查,如果对话框显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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