I have a project that requires a view to be animated whenever the user
performs a certain action - perhaps twenty frames or so, with a total
duration of a second. There's more work required than just updating
the view, so the animation classes are not helpful.

Right now my test program uses a very simple method: I have a handler
that is called to start the animation. The handler's handleMessage()
method calculates the new frame, invalidates the view, and calls
        sendMessageDelayed(obtainMessage(0), 50);

However, the animation isn't smooth - especially, for some reason, in
landscape mode. Portrait mode seems much better (on a G1, if it
matters).

This suggests to me that this isn't the right way to... handle... this
problem. What would be a better way? Calculating time deltas? Starting
a new thread whenever the animation starts and having it repeatedly
calculate and invalidate instead of relying on the handler, even
though it means creating and destroying a new thread every time? (most
of the time the program is idle; the user interacts with it every few
seconds, typically). Starting a thread and leaving it running?

Whether that's the right way or not, what's the most accurate way on
Android to measure time, and to sleep for a specific duration?


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