@Override public void run() { super.run(); try { do { if (myAnim.start == -1 || myAnim.end == -1) { // this is a single image, not an animation tryLoadBitmap(myAnim.filename); } else { for (int i = myAnim.start; i <= myAnim.end; i++) { boolean bitmapLoaded; bitmapLoaded = tryLoadBitmap(myAnim.filename + new DecimalFormat("0000").format(i) + ".png"); if (!bitmapLoaded) { break; } } } } while (myAnim.loop); } catch (InterruptedException e) { e.printStackTrace(); } finally { if (shouldTurn) { myCanvasView.setmLookingRight(!myCanvasView.ismLookingRight()); } } }