Ah ok, that makes sense. Thanks for your reply. I understand what
you're saying, but in all honesty after trying another 3 examples I'm
still unable to resolve this, could you possibly provide some kind of
example for what would work?

Seems if I use a reference to a ProgressDialog in my activity it'll
leak, and if I use the showDialog() methods it'll continue forever.

Thanks

On Nov 7, 4:39 pm, Lance Nanek <[email protected]> wrote:
> >private final class Task extends AsyncTask<Void, Void, Void> {
> ...
> >dismissDialog(DIALOG_TASKING);
>
> A non-static inner class like this has a reference to the instance of
> the class that created it. So that dismissDialog call probably goes to
> the previous instance of your activity in this case. Not the current
> one if there has been an orientation change and the activity has been
> recreated.
>
> >public void onDestroy() {
> >dismissDialog(DIALOG_TASKING);
>
> This is called too late to matter. Dialogs created by showDialog are
> managed by the Activity class. It records which dialogs have to be
> reshown when the activity is recreated due to an orientation change.
> It does so right after the call to onSaveInstanceState. That happens
> before onDestroy.
>
> On Nov 7, 9:53 am, Lee Jarvis <[email protected]> wrote:
>
>
>
> > I apologise if I'm missing something or just being stupid.. But i've
> > tried the following..
>
> >     @Override
> >     public void onDestroy() {
> >         dismissDialog(DIALOG_TASKING);
> >         super.onDestroy();
> >     }
>
> > The dialog is only dismissed if I DONT change orientation, otherwise
> > the "finished" toast will show, but the ProgressDialog will never
> > actually disappear.
>
> > On Nov 7, 2:41 pm, Mark Murphy <[email protected]> wrote:
>
> > > Lee Jarvis wrote:
> > > > This code (kinda) works, the only problem is dismissing the dialog if
> > > > the activity is recreated. I've tried dismissing it if mTaskComplete
> > > > is true but I guess by that time it's lost reference to the
> > > > ProgressDialog.
>
> > > You may need to dismiss the dialog in onDestroy() and reopen it in
> > > onCreate(), if the flag is true.
>
> > > --
> > > Mark Murphy (a Commons 
> > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > Android App Developer Books:http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to