You should use AsyncTask
instead.
Here is the link to the library. It is fairly simple:
1) onPreExecute()
= show ProgressDialog
2) doInBackground()
= execute your code
3) onPostExecute()
= dismiss ProgressDialog
DONE :-)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…