title: How to make random frame animation in android?
body: <p>I have a number of animated images(frames) like image_1,image_2 and image_3.I want to use this animated image in my application so I tried</p>
  
  <pre><code>&lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"
      android:oneshot="false" &gt;
  
      &lt;item
          android:drawable="@drawable/image_1"
          android:duration="2000"/&gt;
      &lt;item
          android:drawable="@drawable/image_2"
          android:duration="50"/&gt;
       &lt;item
          android:drawable="@drawable/image_3"
          android:duration="50"/&gt;
  
  &lt;/animation-list&gt;
  </code></pre>
  
  <p>And set this as background of my layout </p>
  
  <pre><code> public void onWindowFocusChanged(boolean hasFocus) {
      super.onWindowFocusChanged(hasFocus);
      if(hasFocus){
  
          final AnimationDrawable bgDrawable = (AnimationDrawable) ((LinearLayout) findViewById(R.id.animationLayout))
                  .getBackground();
          ((LinearLayout) findViewById(R.id.animationLayout))
                  .post(new Runnable() {
  
                      @Override
                      public void run() {
                          bgDrawable .start();
                      }
                  });
  
          }
      }
  }
  </code></pre>
  
  <p>But this shows the animation repeats every time in the same order. I want to make a <code>random frame animation</code> by using these images.How can i do this?</p>
  
  <p>Thanks in Advance</p>