frame by frame animation not running
- by abc
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();