Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 不按按钮关闭AlertDialog_Android_Android Alertdialog - Fatal编程技术网

Android 不按按钮关闭AlertDialog

Android 不按按钮关闭AlertDialog,android,android-alertdialog,Android,Android Alertdialog,我想通过套接字与服务器建立连接,当手机尝试建立连接时,我想打开一个AlertDialog(警报对话框),但不带在建立连接时关闭的按钮 private void attempToSendXML(AlertDialog.Builder builder, String profile) { SocketClient client = new SocketClient(); Alerts.establishConnection(builder); connectionEstabl

我想通过套接字与服务器建立连接,当手机尝试建立连接时,我想打开一个AlertDialog(警报对话框),但不带在建立连接时关闭的按钮

private void attempToSendXML(AlertDialog.Builder builder, String profile) {
    SocketClient client = new SocketClient();
    Alerts.establishConnection(builder);
    connectionEstablished = client.createClient(server, port);
    //Close the Dialog here!
    if (!connectionEstablished) {
        connectionRefusedAlert(builder);
        return;
    }

您可能需要阅读手册中有关流程对话框的部分。它们也是警报对话框


AlertDialog.Builder返回具有.close()函数的对象。用它来关闭对话框。

要正确删除
对话框,您应该调用