I couldn’t find examples of how to initialize the animation object.
example Animation ticketAnim;
well new Animation(); is not a valid object it seems so I can’t just do Animation ticketAnim = new Animation(); but I would like to. I take the suggested initialization route that the IDE offers which is Animation ticketAnim = null;
of course, accessing this will result in a null pointer exception
what is the right way to do this?
When declaring a new animation, you need to use the constructor of an animation type. Here’s some sample code for one of the animation controllers I use in my code:
The
Animationclass itself is just an abstraction. To use an animation, implement one of Animation’s direct know subclasses (also specified in the link to the Animation API).These include:
If you want, you can also create your own custom animation by extending the
Animationclass. A good example of creating a custom animation can be found here.