Reputation: 55
I want to establish a connection via Socket to a Server, while the phone is trying to establish the connection i want to bring up an AlertDialog to front without buttons that will be closed when the connection is established.
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;
}
Upvotes: 3
Views: 938
Reputation: 17960
In order to remove your Dialog
correctly you should call mDialog.dismiss();.
Upvotes: 0
Reputation: 29985
You may want to read the section in the manual on Process Dialogs. They too are alert dialogs.
http://developer.android.com/guide/topics/ui/dialogs.html#ProgressDialog
AlertDialog.Builder returns an object that has a .close() function. Use that to close the dialogs.
Upvotes: 1