Code example for CountDownTimer

Methods: cancel, start

0
 
			@Override 
			public void onClick(View v) {
				// TODO Auto-generated method stub 
				if (!timerStarted && countDownTimer != null) {
					countDownTimer.start();
					timerStarted = true;
					timer_started = true;
					startB.setText("Cancel");
 
				} else if(timerStarted && countDownTimer != null) {
					countDownTimer.cancel();
					timerStarted = false;
					timer_started = false;
					startB.setText("Start");
				} 
			} 
			 
		}); 
 
		riceT = (Button)this.findViewById(R.id.Rice);