Отображение GIF изображения с библиотекой

Я использую эту библиотеку, чтобы показать изображение GIF:https://github.com/felipecsl/GifImageView

Но я не знаю, как реализовать мое изображение GIF в этом коде. У меня есть некоторые GifImages в папке активов.

Вот мой код:

PlayActivity.java:

import android.app.Activity;
import android.os.Bundle;

import com.felipecsl.gifimageview.library.GifImageView;

import java.io.IOException;
import java.io.InputStream;

public class PlayActivity extends Activity{

    GifImageView gifView;
    //byte[] bytes;

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

        try {
            InputStream is = getAssets().open("rain_4.gif");
            byte[] bytes = new byte[is.available()];
            is.read(bytes);
            is.close();

            gifView = (GifImageView) findViewById(R.id.gifImageView);
            gifView = new GifImageView(this);
            gifView.setBytes(bytes);
            gifView.startAnimation();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        if(gifView != null) gifView.startAnimation();
    }

    @Override
    protected void onStop() {
        super.onStop();
        if(gifView != null) gifView.startAnimation();
    }
}

И layout_play_activity.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".PlayActivity">

    <com.felipecsl.gifimageview.library.GifImageView
        android:id="@+id/gifImageView"
        android:layout_gravity="center"
        android:scaleType="fitCenter"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>

Ответы на вопрос(4)

Ваш ответ на вопрос