frame by frame animation not running

Posted by abc on Stack Overflow See other posts from Stack Overflow or by abc
Published on 2011-11-19T09:15:01Z Indexed on 2011/11/19 9:50 UTC
Read the original article Hit count: 205

Filed under:
|

well,i am a newbie to android..and i dont know whats wrong in my code..

this is my xml file

<?xml version="1.0" encoding="utf-8"?>  
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" id="selected" android:oneshot="false">  
    <item android:drawable="@drawable/w1" android:duration="50" />
    <item android:drawable="@drawable/w2" android:duration="50" />
</animation-list>

my java file

ImageView img = (ImageView)findViewById(R.id.s);
img.setBackgroundResource(R.anim.shape_animation);


// Get the background, which has been compiled to an AnimationDrawable object.
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();


// Start the animation (looped playback by default).
frameAnimation.start();

© Stack Overflow or respective owner

Related posts about java

Related posts about android