Code example for CountDownTimer

Methods: cancel, start

0
		if (countdown() > hurryUpTime) {
			updateBackgroundColor(backgroundRunning);
		} 
 
		restartPlayer(); 
		timer.cancel();
		timer.start();
	} 
 
	private void onStopCounting() { 
		timerRunning = false;
		updateBackgroundColor(backgroundNormal);
		updateTimerText(countdown()); 
 
	} 
 
	private void initTimer() { 
		timer = new CountDownTimer(countdown() * 1000, 250) {
			public void onTick(long millisUntilFinished) {
				int newTime = (int)((millisUntilFinished + 999) / 1000);
				updateTimerText(newTime);