Question: I want to create animated splash screen using gif image. I have used Glide library because it supports gif images. 

I have done following things to achieve this:

1. Created splash.xml with an imageview in it.

```
<ImageView
    android:id="@+id/iv_gif_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

```
2. Inside SplashActivity.java

```

        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);

            ImageView ivImage = (ImageView) findViewById(R.id.iv_gif_view);
            Glide.with(this).load(R.drawable.splash_xxhdpi_2)
                    .asGif().into(ivImage);
        }
```

But when I run the application screen goes black nothing appears on the screen. I'm using Glide `compile 'com.github.bumptech.glide:glide:3.6.1'`

Answer: 
Android does not support GIF so avoid using it since it is memory consuming. Glide is nice image caching library and luckily it supports gif images. 

I'm sharing alternate and efficient way to achieve animated splash screen.

1. Create splash.xml as usual with an image view.
2. Take out each frame from your gif image. I have used splash\_hdpi\_1, splash\_hdpi\_2, splash\_hdpi\_3 for example.
3. create `splash_gif_animation.xml` in drawable with below code

```
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false" >
    <item
        android:drawable="@drawable/splash_hdpi_1"
        android:duration="150"/>
    <item
        android:drawable="@drawable/splash_hdpi_2"
        android:duration="150"/>
    <item
        android:drawable="@drawable/splash_hdpi_3"
        android:duration="150"/>
</animation-list>

```

4. In your `SplashActivity.java` put below code

```
ImageView ivImage = (ImageView) findViewById(R.id.your_image_view);
ivImage.setBackgroundResource(R.drawable.splash_gif_animation);

AnimationDrawable splashAnimation = (AnimationDrawable) ivImage.getBackground();
splashAnimation.start();
```

5. You are done:)
Try this:

```
ImageView ivImage= (ImageView) findViewById(R.id.iv_gif_view);
GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(ivImage);
Glide.with(this)
     .load(R.drawable.splash_xxhdpi_2)
     .into(imageViewTarget);

```