I'm creating the Handler in my Activity, so each time the activity is
started it creates a new Handler. The issue is that when the activity
is destroyed and created again, the Handler in the destroyed activity
still receives some messages. So, am I doing something wrong? Ideally
I think I should be destroying the handler in the activity's
onDestroy, but there doesn't appear to be any way of doing that as far
as I can tell.


On Apr 30, 3:27 pm, Dianne Hackborn <hack...@android.com> wrote:
> A Handler is associated with a Looper, not an activity.  Anyone can make a
> Handler for the main thread, and post messages to it, and they will be
> processed.  What happens to activities on that thread has no impact on
> handlers.
>
> Another way to look at it -- you don't pass an Activity to a Handler when
> creating the Handler, so there is no association a Handler has with any
> Activity.  (The Looper us implicitly known because there is a 1:1
> relationship between a running thread and a Looper.  There is no such
> relationship with an Activity.)

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

Reply via email to