The first doubt is how to stop the animation once it's done, right now it's a loop and I want it to only do the animation and stop once:
ImageView img_check_guia3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_guia_parte3);
img_check_guia3 = (ImageView) findViewById(R.id.img_check_guia3);
AnimationDrawable animacion = (AnimationDrawable)img_check_guia3.getDrawable();
animacion.start();
}
And the other question is, how can I do so that my application does not slow down when I open the class with the animation?
animacion
<animation-list android:id="@+id/handimation" android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/check_01" android:duration="50" />
<item android:drawable="@drawable/check_02" android:duration="50" />
<item android:drawable="@drawable/check_03" android:duration="50" />
<item android:drawable="@drawable/check_04" android:duration="50" />
<item android:drawable="@drawable/check_05" android:duration="50" />
<item android:drawable="@drawable/check_06" android:duration="50" />
<item android:drawable="@drawable/check_07" android:duration="50" />
<item android:drawable="@drawable/check_08" android:duration="50" />
<item android:drawable="@drawable/check_09" android:duration="50" />
<item android:drawable="@drawable/check_10" android:duration="50" />
<item android:drawable="@drawable/check_11" android:duration="50" />
<item android:drawable="@drawable/check_12" android:duration="50" />
<item android:drawable="@drawable/check_13" android:duration="50" />
<item android:drawable="@drawable/check_14" android:duration="50" />
<item android:drawable="@drawable/check_15" android:duration="50" />
<item android:drawable="@drawable/check_16" android:duration="50" />
<item android:drawable="@drawable/check_17" android:duration="50" />
<item android:drawable="@drawable/check_18" android:duration="50" />
<item android:drawable="@drawable/check_19" android:duration="50" />
<item android:drawable="@drawable/check_20" android:duration="50" />
<item android:drawable="@drawable/check_21" android:duration="50" />
<item android:drawable="@drawable/check_22" android:duration="50" />
<item android:drawable="@drawable/check_23" android:duration="50" />
<item android:drawable="@drawable/check_24" android:duration="50" />
<item android:drawable="@drawable/check_25" android:duration="50" />
<item android:drawable="@drawable/check_26" android:duration="50" />
<item android:drawable="@drawable/check_27" android:duration="50" />
<item android:drawable="@drawable/check_28" android:duration="50" />
<item android:drawable="@drawable/check_29" android:duration="50" />
<item android:drawable="@drawable/check_30" android:duration="50" />
<item android:drawable="@drawable/check_31" android:duration="50" />
<item android:drawable="@drawable/check_32" android:duration="50" />
<item android:drawable="@drawable/check_33" android:duration="50" />
<item android:drawable="@drawable/check_34" android:duration="50" />
<item android:drawable="@drawable/check_35" android:duration="50" />
<item android:drawable="@drawable/check_36" android:duration="50" />
<item android:drawable="@drawable/check_37" android:duration="50" />
<item android:drawable="@drawable/check_38" android:duration="50" />
<item android:drawable="@drawable/check_39" android:duration="50" />
<item android:drawable="@drawable/check_40" android:duration="50" />
<item android:drawable="@drawable/check_41" android:duration="50" />
<item android:drawable="@drawable/check_42" android:duration="50" />
<item android:drawable="@drawable/check_43" android:duration="50" />
<item android:drawable="@drawable/check_44" android:duration="50" />
<item android:drawable="@drawable/check_45" android:duration="50" />
<item android:drawable="@drawable/check_46" android:duration="50" />
<item android:drawable="@drawable/check_47" android:duration="50" />
</animation-list>
Obviously if I use less images it becomes more fluid, but I need them to be 47 to have a full animation.
- They are 47 .png
- 700x700
- Each png about 16kb
- In total all images do not reach 1mb
What could I do to keep it from slowing down? I do not think that with 3GB of RAM and 801 Snapdragon can not with that animation.
Thanks
EDITO3: @MarcGV
clase
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ImageView;
import otrointento.dos.R;
public class GuiaParte3 extends AppCompatActivity {
ImageView img_check_guia3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_guia_parte3);
img_check_guia3 = (ImageView) findViewById(R.id.img_check_guia3);
AnimationDrawable animDrawable = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
animDrawable = (AnimationDrawable) getDrawable(R.drawable.movimiento_check_guia3);
}
img_check_guia3.setBackgroundDrawable(animDrawable);
animDrawable.setOneShot(true);
animDrawable.start();
}
}