Mark, Dianne, SoB,

Thank you all for your valuable input.

@Mark:
After reading what Dianne and SoB posted, I assume you would agree to
change your answers to yes/yes and yes.

> If you wish to modify the UI, your AsyncTask needs access to the current
activity.

I am aware of that. I was using a weakreference in my AsyncTasks to
the currently active Activity, regardless of whichever Activity
instance spawned the Task in the past (this weakreference was (re)set
in my main activity's onCreate method - including after a
conf.change).

@Dianne, @SoB:
Thank you for clarifying this. Funny how we all come up with
(different) solutions on our own for something that EACH of us must
deal with (execution of AsyncTasks/Threads during conf.change). I
think it would really help future newcomers if all this conf. change
behavior was explained somewhere in more detail (in the DOCs? on the
blog?). It took me a loooong time finding
onRetainNonConfigurationInstance(), which I ended up using together
with the WeakReferences mentioned above.
Using a static reference updated during OnCreate and OnDestroy inside
the main activity is definitely a simpler way of achieving the same.
>From now on, I will be doing that instead.

Thank you all again for the help,

-szabolcs

--~--~---------~--~----~------------~-------~--~----~
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