Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble in Frame by Frame Animation in Android
    primarykey
    data
    text
    <p>I am facing a problem in <strong>Frame by Frame animation in Android</strong>. Actually i am having lots of images as frames, for that i have crated different animation-list files for different animation. On the main screen i am having one background image on which i am having different buttons for different animation. I am done with animation also, but when i click 2nd time on the buttons the animation does not work. Means it is working only once. I don't why this is happening. Here is some code snippet of my project.</p> <p><strong>Animation List File:-</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"&gt; &lt;item android:drawable="@drawable/cat_angry0000" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0001" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0002" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0003" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0004" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0005" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0006" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0007" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0008" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0009" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0010" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0011" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0012" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0013" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0014" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0015" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0016" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0017" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0018" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0019" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0020" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0021" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0022" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0023" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0024" android:duration="50" /&gt; &lt;item android:drawable="@drawable/cat_angry0025" android:duration="50" /&gt; &lt;/animation-list&gt; </code></pre> <p><strong>Code:-</strong></p> <pre><code>ImageView rocketImage; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.catlayout); rocketImage = (ImageView) findViewById(R.id.backgroundCat); rocketImage.setImageBitmap(null); rocketImage.setBackgroundResource(R.anim.angry_tail_animation); } public void headButtonClicked(View v) { final AnimationDrawable mailAnimation = (AnimationDrawable) mMailTab.getBackground(); mMailTab.post(new Runnable() { public void run() { if ( mailAnimation != null ) mailAnimation.start(); } }); } </code></pre> <p><strong>headButtonClicked is a button placed by me for starting animation. It work only once. If anybody having any idea that how to resolve this problem please kindly help me.</strong> </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload