Sundar wrote: > I want to show a progress dialog until the content gets downloaded and > processed. But when i call the progessdialog.show() method I am > getting the following error. > > 'android.view.WindowManager$BadTokenException: Unable to add window -- > token android.os.binderpr...@435904d8 is not valid; is your activity > running'
Call show() from onPreExecute() or before starting your AsyncTask, then call dismiss() in onPostExecute(). > I use the get method to get the result from the user task. I have no idea what this means. > I make the > main thread to wait until the usertask > completes its work. I know this is a bad way, but the normal handler > does not work here. Then you need to rewrite your code. Blocking the main thread is a prescription for disaster. > I think it is not good idea to start a new activity > in the onPostExecute method. Why do you think this? You might consider taking the approach of passing download instructions to the second activity (via extras) and having it display the progress dialog, arrange for the download, and dismiss the progress dialog. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---