Simple Animation Situation

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

Simple Animation Situation

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

[align=left]Hi!

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"?>
<animation-list

xmlns:android="http://schemas.android.com/apk/res/android"

<animation-list
android:id="@+id/myanimation"
android:oneshot="false"
>
<item android:drawable="@drawable/laptopblue" android:duration="200" />
<item android:drawable="@drawable/laptopred" android:duration="200" />
<item android:drawable="@drawable/laptopyellow" android:duration="200" />
</animation-list>
[/align]



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?

Thanks!

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

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 9 guests