1. Create xml file named "flag.xml" under drawable folder
2. Add following code to your flag.xml
<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/flaganim" android:oneshot="false"> <item android:drawable="@drawable/sliit" android:duration="4000" /> <item android:drawable="@drawable/mlb" android:duration="4000" /> <item android:drawable="@drawable/logo" android:duration="4000" /> <item android:drawable="@drawable/metro" android:duration="4000" /> <item android:drawable="@drawable/convacation" android:duration="4000" /> <item android:drawable="@drawable/matara" android:duration="4000" /> </animation-list>
3. To your main activity add following code
final ImageView splashImageView = (ImageView) findViewById(R.id.imageView2);
splashImageView.setBackgroundResource(R.drawable.flag); final AnimationDrawable frameAnimation = (AnimationDrawable)splashImageView.getBackground(); splashImageView.post(new Runnable(){ @Override public void run() { frameAnimation.start(); } });
4. Run the project
That's All :)
Thank You