2014-01-27 62 views
0
for (int i=0; i<HisXArray.size(); i++) { 
      ycoord2 = HisYArray.get(i); 
      major2 = HisMajorArray.get(i); 
      xcoord2 = HisXArray.get(i); 
      minor2 = HisMinorArray.get(i); 
      time3 = TimeArray.get(i); 
      timer = new CountDownTimer(time3, 1000) { 

       @Override 
       public void onFinish() { 
        Log.e("Timer", xcoord2 + " " + ycoord2 + " " + time3); 
        mView.mFadePaint.setColor(Color.BLACK); 
        mView.drawOval(mView.mCanvas, xcoord2, ycoord2, 2*major2, 2*minor2, mView.mFadePaint); 
        mView.invalidate(); 
       } 
       @Override 
       public void onTick(long millisUntilFinished) { 
        // TODO Auto-generated method stub 

       } 
      }.start(); 

當我試圖繪製使用計時器的東西,onFinish只有當time3 = 0和當我= HisXArray.size() - 1,即最後一次調用。CountDownTimer不能正常工作

回答

0

實施onTick()中的任何中間步驟。 By design,onFinish()只有在倒計時完成時才被調用。