Good I'm trying to make an animation using an XML and animation-list, I get everything right but the problem I have is that I want the order of the animation to be always different every time it starts it's activity
<?xml version="1.0" encoding="utf-8"?>
<animation-list
xmlns:android= "http://schemas.android.com/apk/res/android"
android:oneshot= "false">
<item android:drawable="@drawable/dice1"
android:duration="200" />
<item android:drawable="@drawable/dice2"
android:duration="200" />
<item android:drawable="@drawable/dice3"
android:duration="200" />
<item android:drawable="@drawable/dice4"
android:duration="200" />
<item android:drawable="@drawable/dice5"
android:duration="200" />
<item android:drawable="@drawable/dice6"
android:duration="200" />
</animation-list>
That would be the xml that I use, only the 6 images I use, and then I'll start the animation in the activity
private AnimationDrawable animacion;
private AnimationDrawable animacion2;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pantalla_partida);
dado = (ImageView) findViewById(R.id.Dado);
dado2 = (ImageView) findViewById(R.id.Dado2);
animacion = (AnimationDrawable) ContextCompat.getDrawable(this,R.drawable.animacion);
animacion2 = (AnimationDrawable) ContextCompat.getDrawable(this,R.drawable.animacion);
dado.setImageDrawable(animacion);
dado2.setImageDrawable(animacion2);
This would be the entire code, if possible also want to know if it is possible to know what current frame has the animation.