import android.os.CountDownTimer; MyCount timerCount; public class TryCountdown extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); timerCount = new MyCount(5*1000, 1000); //倒數5秒 timerCount.start(); //開始倒數 public class MyCount extends CountDownTimer { public MyCount(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); } @Override public void onFinish() { // 倒數結束時,會執行這裡 } @Override public void onTick(long millisUntilFinished) { } } // end of MyCount }
沒有留言:
張貼留言