I followed the android developer site to add gif image in my application. But the image is not showing as animated, it shows like a normal image.
Animation in drawable
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/los01" android:duration="50" />
<item android:drawable="@drawable/los02" android:duration="50" />
</animation-list>
Coding
layout.setBackgroundResource(R.drawable.bg);
img.setBackgroundResource(R.drawable.mylosanim);
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
frameAnimation.start();
tv1.setText("Sorry!!!Play Again!!!");
tv3.setText("Your Level-1 Score:"+Integer.toString(score));
layout.setClickable(true);
frameAnimation.stop();