On 02/12/2012 12:27 AM, momo wrote:
one last question though - since the Handler is running in the main UI
thread, are there potential issues? The animation is brief (500ms)
and I'll probably try to disable any other interactions while it's
happening, but I'm pretty new to multithreaded environments and wonder
if there's a likely problem with how I've got it set up now:
This is not a multithreaded environment you've got here.
Your code most likely creates the Handler object on the UI thread, and
if so, that's where it receives messages. This is correct, since the
Android UI framework is not thread-safe and your code should only be
touching views from the UI thread.
Here is a suggestion for choosing the animation frame rate: you can use
View#postInvalidate to mark a view as "dirty", and update animation
state inside the next onDraw, using actual elapsed time (seems like you
already have a class that tracks that).
UI rendering is locked to the hardware frame rate, so you won't be
redrawing more often than necessary -- and on the other hand, you won't
be computing animations that never get drawn.
-- K
--
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