Some things to consider with respect to your proposed approach:
- If the Activity is destroyed while your background threads are
running, what should happen?
- Should the Activity's onDestroy() cancel the threads somehow?
- If the threads be allowed to finish their work, what should
happens then? The original Activity is now dead, so sending a message
to it makes no sense.
- If your ControllerThread (or its Runnable) is a non-static inner
class (which includes anonymous inner classes) of the Activity, it
will hold an implicit reference to the Activity, even after it is
destroyed. This can be a big memory leak if your thread lasts a long
time. The same consideration applies to your FutureTask subclass. In
short, make sure all classes are static or top-level classes.
On Apr 9, 12:17 pm, HippoMan <[email protected]> wrote:
> Thank you, social hub. Our messages crossed. I think that the message
> handler I describe in my previous post is the same one that you are
> referring to.
--
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