O'Reilly logo

Android 3.0 Animations by Alex Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action—receiving animation events

We want to complete our block's journey from one tower to another. To do this, we will use an AnimationListener that adds the block to the second tower as soon as the animation of it leaving the first tower has ended.

  1. We will extend the BlockMover to do a drop animation as soon as it has finished removing the block from its tower. Add Animation.AnimationListener to the interfaces that the BlockMover supports.
    private class BlockMover implements Animation.AnimationListener {
    

    Also add the new methods that the AnimationListener interface provides. Note that we only really care about the last method for this tutorial.

    public void onAnimationRepeat(Animation animation) {} public void onAnimationStart(Animation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required