I have about 90 pngs that I want to show them as an animation in my android app. I tried using animation list but the app uses about 120 MB of memory! I searched for more efficient ways and I found some solutions with openGL. The problem is I don't have any idea how to use openGL to do that and I don't know any thing about opengl! Is there any guide? How should I do that ?
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:duration="34" android:drawable="@drawable/a1"/>
<item android:duration="34" android:drawable="@drawable/a2"/>
<item android:duration="34" android:drawable="@drawable/a3"/>
.
.
.
<item android:duration="34" android:drawable="@drawable/a90"/>
<item android:duration="34" android:drawable="@drawable/a91"/>
</animation-list>
my ImageView:
<ImageView
android:id="@+id/iv_loading_animation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:scaleType="centerInside"
android:background="@drawable/loading_animation"/>
Main activity:
ImageView animationLoaderIv = (ImageView)rootView.findViewById(R.id.iv_loading_animation);
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams)animationLoaderIv.getLayoutParams();
layoutParams.height = width;
layoutParams.width = width;
animationLoaderIv.setLayoutParams(layoutParams);
((AnimationDrawable)animationLoaderIv.getBackground()).start();