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.
Asked
Active
Viewed 1,470 times
2

Matt Bryant
- 4,841
- 4
- 31
- 46

Hitesh Kamani
- 935
- 10
- 24
-
3can u post your code? – Raghunandan Aug 22 '13 at 05:34
-
1post your code then we will solve your problem. – Hemantvc Aug 22 '13 at 05:36
-
post your code so that we can help you out – Meher Aug 22 '13 at 05:38
-
protected void onPreExecute() {super.onPreExecute(); progress_dialog.show(); progress_dialog.setIndeterminate(true); } protected String doInBackground(String... params) { progress_dialog.setCancelable(true); json_string_category=json_parser.getJsonStringfromUrl(jsonurl + area_id_async); return null; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); progress_dialog.dismiss(); doing image loading from web is done here. } – Hitesh Kamani Aug 24 '13 at 13:17
2 Answers
2
Check tutorials how to do asynchronus task in Android:
And here are some other StackOverflow questions that are similar:
Progress dialog problem in Android
Progress Dialog on open activity
Progress Dialog while starting new activity
Android: Progress Dialog spinner not spinning
Updating progress dialog
android: showing a progress dialog
0
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.

SMBiggs
- 11,034
- 6
- 68
- 83
-
On second thought, this probably isn't the case. Dialogs MUST occur (at least in some important part) within the UI thread. Please ignore this answer; it was just a stab in the dark. – SMBiggs Jun 19 '15 at 20:56