Skip to content
Advertisement

Setting up an AnimationListener for an ObjectAnimator

In my program, I have an ObjectAnimator which moves an ImageView from left to right. I am trying to set up a listener which will execute a task when the ObjectAnimator is finished running. Here is the relevant section of code which I am currently using to try to accomplish this:

JavaScript

When I try to run this in Android Studio, I am getting the error: MainActivity is not abstract and does not override abstract method onAnimationStart() in MainActivity. What do I have to do to fix this error?

Advertisement

Answer

Since you implemented AnimatorListener in your MainActivity, you must include all its abstract methods, and change nAnim.addListener(new Animat.... to nAnim.addListener(this)

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement