Hitesh Kamani
Hitesh Kamani

Reputation: 933

Progress Dialog is not spinning enough in asynctask in android

I am using progress dialog in my Asynctask class. I put progressdialog.show() on onpreExecte() method of asynctask and dismissing the dialog in onPostExecute. My problem is the wheel in dialog is stops after 2-3 seconds but my background process is working. Can anyone help me to solve this problem? I want to spin the wheel until the background process is over.

Upvotes: 2

Views: 1473

Answers (1)

SMBiggs
SMBiggs

Reputation: 11688

Just a guess, but it seems to me that starting the progress dialog INSIDE the AsyncTask causes the dialog to work on the AsyncTask thread, instead of the UI thread.

I suggest moving the progressdialog.show() to just before you call execute() in your Activity.

Upvotes: 0

Related Questions