开发者

Can't check if dialog is showing

开发者 https://www.devze.com 2023-03-15 14:57 出处:网络
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 is

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 isS开发者_JAVA技巧howing() 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号