public void handleMessage(Message msg) { Ball B; for (int idx = 0; idx < arBall.size(); idx++) { B = arBall.get(idx); B.Move(getWidth(), getHeight()); if (B.count > 4) { arBall.remove(idx); idx--; } } invalidate(); mHandler.sendEmptyMessageDelayed(0, DELAY); }