title: Android loading and showing a lot of images in ImageView(frame by frame animation) hangs in certain moments
body: <p>I've created an application that show around 250 images in ImageView. Images are loaded one after another, 15-30 images per second. Basically the whole thing gives an illusion of a rotating 3D object, at least it should.
  The problem is next, app hangs when loading certain images(i.e. I see a few seconds of fluid animation and then animation hangs, jump 10-15 frames(images) ahead and continues. It always happens at the same places in animation cycle.
  I though that Android might not have enough resources to handle something like this, so I've resized images to half their size, but it did't help. I've tried buffering images but that did't help either(actually, maybe a little, I think that animation looks a little bit smoother).
  And now the weirdest thing. I use the touch screen to allow users to "rotate" the 3D object on those images, and while rotating I again experience those hangs at exactly the same places as with the animation.</p>
  
  <p>All images are in .png format and their size vary from 15kB to 40kB.</p>
  
  <p>I use the following code for the animation:</p>
  
  <pre><code>new Thread(new Runnable() {
  
     @Override
     public void run() {
      while (!stopStartupAnimation &amp;&amp; li &lt; images_360.length) {
       final int fli = li;
       handler.post(new Runnable() {
  
        @Override
        public void run() {
         //Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
         //imageCanvas.setImageResource(images_360[fli]);
         imageCanvas.setImageBitmap(imageStackNext.pop());
         System.out.println("rawX = " + fli);
        }
       });
       int ti = fli +25;
       if(ti &gt; images_360.length-1){
        ti = ti - images_360.length;
       }
       imageStackNext.push(BitmapFactory.decodeResource(getResources(), images_360[ti]));
       synchronized (this) {
        try {
         wait(1000 / 25);
        } catch (InterruptedException e) {
         e.printStackTrace();
        }
       }
       li++;
       li++;
       if (li &gt;= images_360.length) {
        li = 0;
       }
      }
     }
    }).start();
  </code></pre>