You're using a static show()
method that returns an instance of ProgressDialog
that you throw away. The dialog you dismiss is not the same that is showing. To fix, change:
waitDialog=new ProgressDialog(this);
waitDialog.show(this, sTitle, sMessage);
to
waitDialog = ProgressDialog.show(this, sTitle, sMessage);
As mentioned by others, an AsyncTask
is really the canonical way to perform operations like this instead of working with Thread
s directly.