Yep, that looks good.
Strictly, it is not necessary to do the 'if (...)' statement at all. You
can just always do the mHandler.post(...) instead.
On Tuesday, October 30, 2012 2:39:24 PM UTC-4, Jay Howard wrote:
>
> Here's what I ended up doing:
>
> 1. Ensure that my timer class, which creates a
Here's what I ended up doing:
1. Ensure that my timer class, which creates a Handler in its method
on the caller's thread, is always instantiated on the main thread.
2. My class is also a BroadcastReceiver, but onReceive() is guaranteed to
be called by the main thread so it can access the handler
Thanks so much for the response! If you'll indulge me with a few more
questions...
So I instantiate the handler in the onCreate() method of my Application,
which I assume means it's tied to the UI thread.
The method that removes and re-sends messages is called primarily on the UI
thread, but can
It depends which thread is callling the code-snippet you show above (the
one calling 'removeMessage').
If your code, calling 'removeMessage', is run on the same thread that is
tied to the *handler*, you're fine. The message you sent will not be
handled/run until your code finishes first. No ext
4 matches
Mail list logo