Skip to content Skip to sidebar Skip to footer

Android Progress Dialog Not Showing

This is the handler, in the main Thread, which shows and dismisses a progress dialog. public static final int SHOW = 0; public static final int DISMISS = 1; public Handler pdHandle

Solution 1:

Maybe you should NOT use runOnUiThread() and better handle this via the Looper.prepare() function:

What is the purpose of Looper and how to use it?

Furthermore your AsyncTask is finished and runs in onPostExecute() then you are in the UI-Thread so an additional runOnUiThread() is not necessary.

Solution 2:

I Think it will not work.The Place from where you are sending message

pdHandler.sendMessage(pdHandler.obtainMessage(DISMISS));

you need to put all those heavy statements or work into another non ui thread. Handler is used to put a message into Thread message que if your thread will busy then it will execute that message after previous messsage. So because of your ui heavy work that dialog box is not updating. Always use services for your background work. Never try to put everything in your UI thread only.

Hope it will help you otherwise use AsyncTask it is the best method to do such things. If still you are facing the same problem then post that code from where you are sending your message to handler.

Solution 3:

I made it work by turning the code into AsyncTask and using try/catch blocks.

See my answer in this post

I am not sure if AsyncTask is necessary, but after I had it, the try/catch block made the difference.

Post a Comment for "Android Progress Dialog Not Showing"