I want to make a one shot animation but be able to play it as many times as I want. Right now it plays only the first time.
.xml:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/p1_ch1" android:oneshot="true">
    <item 
      android:drawable="@drawable/p1_ch1_5" 
      android:duration="500"/>
    <item 
      android:drawable="@drawable/p1_ch1_4" 
      android:duration="1000"/>
    <item 
      android:drawable="@drawable/p1_ch1_5" 
      android:duration="500"/>
</animation-list>
.java:
public void handler_p1_ch1_5 (View target){
      ImageView iv = (ImageView)findViewById(R.id.p1_ch1_5);
      AnimationDrawable aw = (AnimationDrawable)iv.getBackground();
      aw.start();
}
Just call aw.stop() before aw.start()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With