I have an
// Dialog is not shown.
mybluetoothsocket.connect(); // This blocks and takes a few seconds to run.
// Dialog is shown.
bluetoothsocket.connect() is blocking, which you said it is, you should put it out of the UI main thread. What you can do is put it inside an AsyncTask. Your
myalertdialog.show() can be executed right before calling your
AsyncTask. Then call