Skip to content Skip to sidebar Skip to footer

Android Problem With Progress Dialog

In my app i m trying to fetch data from server and storing in database. When it is doing all these work i want at that time progressdialog should show, if successfully data fetches

Solution 1:

Not exactly an answer to your particular question, but have you considered AsyncTask? It's pretty much designed to handle situations like yours, where a task is performed async while showing some progress (and eventual result) on the UI thread. Alternativelly, you could broadcast an intent and have your activity catch it to show the toast, since your Toast should be show from your UI thread as well.

update: AsyncTask reference - http://developer.android.com/reference/android/os/AsyncTask.html

Solution 2:

What you are doing is totally wrong. UI thread handles all UI changes, but here you are creating ProgressDialog in UI thread and dismissing it in some Other Thread.. A solution is make use of AsyncTask http://developer.android.com/reference/android/os/AsyncTask.html

Post a Comment for "Android Problem With Progress Dialog"