Simple Animation Situation

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

Simple Animation Situation

Postby kdiddy » Wed Apr 01, 2009 2:45 am


I'm trying to figure out how to make a simple animation using png's in my drawable folder. When the user clicks on an button, an animation happens on that button. I want to have it run a little animation cycling through some pics.

I have the following as XML but am unclear on the java

<?xml version="1.0" encoding="utf-8"?>


<item android:drawable="@drawable/laptopblue" android:duration="200" />
<item android:drawable="@drawable/laptopred" android:duration="200" />
<item android:drawable="@drawable/laptopyellow" android:duration="200" />

I'm having an error with the code I'm using to identify the animation. It force closes.

myAnimation = AnimationUtils.loadAnimation(this, R.anim.myanimation);
Is onDraw or a Timer needed, or will it just work based on he duration set in the XML? I'm just not sure what objects and methods are needed to make it work.

Any suggestions?


Junior Developer
Junior Developer
Posts: 19
Joined: Wed Apr 01, 2009 2:30 am


Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests