image animation in android
<p>hi i have to repeat my image sequence i am using  thread and AnimationDrawable.. but it is not working continuously . i don't want to stop this animation until next activity is not started through button click event .   </p>

<p>` </p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);{
</code></pre>

<p>`<br>
final ImageView splashImage=(ImageView)findViewById(R.id.heartFunction);
     splashImage.setBackgroundResource(R.drawable.slide_right);
  splashAnimation = (AnimationDrawable) splashImage.getBackground();
}</p>

<pre><code>public void onWindowFocusChanged(boolean hasFocus) {
</code></pre>

<p>super.onWindowFocusChanged(hasFocus);</p>

<p>if ( isFocused ) {
   //isFocused = false;</p>

<p>splashAnimation.start();
   var=false;
   new Thread(new Runnable() {
    public void run() {
     try {
      Thread.sleep(SPLASH_DISPLAY_LENGTH);
     } catch (InterruptedException e) {
      e.printStackTrace();
     }</p>

<pre><code>}
</code></pre>

<p>}).start();
  }</p>

<p>slide_right.xml:-</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"
</code></pre>

<p>android:oneshot="true"></p>

<pre><code>&lt;item android:drawable="@drawable/heartcolored0" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored2" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored4" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored5" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored6" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored7" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored8" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored9" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored10" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored11" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored12" android:duration="200" /&gt;
&lt;item android:drawable="@drawable/heartcolored13" android:duration="200" /&gt;
</code></pre>

<p></p>
