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;
}
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.