Al, just some suggestions but are you managing your progress dialog from the worker thread?
Perhaps I can help if I describe what I did in my app. My main activity view has a function 'updateData' which launches the background thread to fetch the data for the view. Inside the' updateData' I call 'showDialog' with the id of the busy dialog so: showDialog(LOADING_DIALOG_KEY); this is _prior_ to launching the worker thread. When the results are returned the worker thread calls a function in the main activity 'showData' which clears the busy dialog with dismissDialog(LOADING_DIALOG_KEY); and updates the view. That is, the busy dialog is launched and cleared from the main activity. I implemented the onCreateDialog fn: protected Dialog onCreateDialog(int id) { switch (id) { case LOADING_DIALOG_KEY: { ProgressDialog dialog = new ProgressDialog(this); dialog.setMessage("Updating Forecast..."); dialog.setIndeterminate(true); dialog.setCancelable(true); return dialog; } default: break; } return super.onCreateDialog(id); } The problem I was seeing then was that when I switched the orientation of the phone when the dialog was active it was never being closed. I was calling the initial data fetch in the onCreate from my main activity. When I moved it to the onResume the problem went away. I had then to ensure that only the first 'onResume' call triggered the initial data fetch otherwise every time I returned from an activity launched from the main (like a properties view) it reloaded the data regardless. I just did this with a flag which was initialised on creation of the activity. So, I guess what I am suggesting is that you move the function which fetches the data into the main activity, pass a references to the activity to the worker thread, only deal with the progress dialog by calling fns from the main activity and implement the onCreateDialog fn. Al. On Dec 15, 5:27 pm, Al Sutton <a...@funkyandroid.com> wrote: > So it looks like the problem still is unsolved. > > That thread seems to have a nice theoretical summary from Greg that > doesn't actually tell you how to fix the problem using the android > classes available, an link to a post where one person points out that > the solution given only works for the first orientation change, and a > few more people asking how to do this... > > Is this really a problem with no currently known fully working solution? > > Al. > > > > Alistair. wrote: > > I had a sort of similar problem. > > > This has been discussed here: > > >http://groups.google.com/group/android-developers/browse_thread/threa... > > > On Dec 15, 4:44 pm, Al Sutton <a...@funkyandroid.com> wrote: > > >> A code snippet which prevents an "java.lang.IllegalArgumentException: > >> View not attached to window manager" being thrown when .dismiss() is > >> called on a progress dialogue box which is on screen when the device > >> changes orientation. > > >> Thanks, > > >> Al. > > >> -- > >> ====== > >> Funky Android Limited is registered in England & Wales with the > >> company number 6741909. The registered head office is Kemp House, > >> 152-160 City Road, London, EC1V 2NX, UK. > > >> The views expressed in this email are those of the author and not > >> necessarily those of Funky Android Limited, it's associates, or it's > >> subsidiaries. > > -- > ====== > Funky Android Limited is registered in England & Wales with the > company number 6741909. The registered head office is Kemp House, > 152-160 City Road, London, EC1V 2NX, UK. > > The views expressed in this email are those of the author and not > necessarily those of Funky Android Limited, it's associates, or it's > subsidiaries. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---