Search code examples
androideclipseanimationviewflipper

Android LoadAnimation error


I want to create an animation in Android for a ViewFlipper. I made the xml files and I know try to create the animation but the eclipse gives me an error.

The method loadAnimation(Context, int) in the type AnimationUtils is not applicable for the arguments (LoafMakingTutorial, View)

and this is the code

Animation right_in = AnimationUtils.loadAnimation(LoafMakingTutorial.this,findViewById(R.anim.right_flip_in));

What is the problem? I've already tried the solutions that the eclipse mentioned, but none of them worked.


Solution

  • This Message shows you exactly what you need to know:

    The method loadAnimation(Context, int) in the type AnimationUtils is not applicable for the arguments (LoafMakingTutorial, View)

    You can't use a View as a parameter for a method that expects an int. Just change the findViewById part. If you already have the ID of the View you don't have to look for the Viewbehind that ID.