Hi Mike,

Is it safe to cache a Handler (in a static variable)? Some objects,
such as Activities or Drawables, are not safe to cache statically and
share amongst multiple activity-instances due to possible memory leaks
(memory referencing to destroyed activities that doesn't get cleaned
up in a timely manner).


On May 28, 10:32 am, Mike Hearn <[email protected]> wrote:
> You don't need a Service, that's way too complicated for what you
> need. Especially if you use the RPC stuff (optional but the docs don't
> tell you that!)
>
> If you create the progress dialog using the onCreateDialog() method
> then it'll be automatically reconstructed after an orientation
> change.
>
> To receive callbacks as to progress, you can just send to a static
> Handler. Create the Handler in your onCreate if it's not already
> created, so it's shared between all instances of your activity. Your
> thread can then post updates to it.
>
> When your activity is stopped or paused, you can interrupt() that
> thread to tell it to shut down.
--~--~---------~--~----~------------~-------~--~----~
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