I am downloading a file from dropbox which is taking a few seconds. I want to add a ProgressDialog for the download but I don\'t know how to do that.
See there are actually 4 methods of AsyncTask:
onPreExecute() - you can do some pre execution task here.doInBackground() - you can perform some background work here.onPostExecute() - you can perform post execution task here. Means like displaying data in ListView, update TextView, etc.onProgressUpdate() - To update UI while background operation is going on.So in your case, you can show progress dialog or progress bar inside onPreExecute() method of AsyncTask and dismiss(() the same inside onPostExecute().