Playing Animators Together

If all you need to do is kick off a few animations at the same time, then your job is simple: call start() on them all at the same time. They will all animate in sync with one another.

For more sophisticated animation choreography, this will not do the trick. For example, to complete the illusion of a sunset, it would be nice to show the sky turning from orange to a midnight blue after the sun goes down.

This can be done by using an AnimatorListener. AnimatorListener tells you when an animation completes. So you could write a listener that waits until the end of the first animation, at which time you can start the second night sky animation. This is a huge hassle, though, and requires a lot of listeners. ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.