2013-02-16 19 views
0

這是我在countdowntimer中使用的代碼。動畫中的CountDownTimer

mDetector = new GestureDetector(this, new MyGestureDetector()); 

ImageView iv = (ImageView)findViewById(R.id.imageView1); 
iv.setOnTouchListener(new OnTouchListener(){ 
@Override 
public boolean onTouch(View arg0, MotionEvent arg1) { 
    mDetector.onTouchEvent(arg1); 
    final ImageView iv = (ImageView) findViewById(R.id.imageView1); 
    iv.setVisibility(View.GONE); 

    new CountDownTimer(3000, 1000) { 
     public void onTick(long millisUntilFinished) { 
     AnimationDrawable loadingAnimaton; 
     loadingAnimation = (AnimationDrawable) ImageView.getBackground(); 

    }loadingAnimation.start(); 

     }.start(); 
    return true; 
}}); 
} 
} 

--the錯誤我在loadingAnimation.start();獲取說,令牌 語法錯誤「開始」,標識預計將設置我的倒計時數到的圖像,此令牌

任何替代方法之後。

回答

0

其實你有2 start()調用,都看起來不對。

試試這個

 CountDownTimer ct=new CountDownTimer(3000, 1000) { 

     public void onTick(long millisUntilFinished) { 
     AnimationDrawable loadingAnimaton; 
     loadingAnimation = (AnimationDrawable) ImageView.getBackground(); 
     loadingAnimation.start(); 
    } 


    } 
    ct.start();