From Android developper :
CountDownTimer myCountDown = new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("done!");
}
}.start();
You can use these callbacks to handle ticks and the end of timer.
The first paramter determinates the duration of the timer.
The second parameter of CountDownTimer determinates the duration of one tick until the end.
EDIT:
If you need to stop the timer before the end of your 5 seconds, you can store the current time before launch your countdown:
final long timeBeforeLaunchCountDown = System.currentTimeMillis();
So, when a click occurs (user answers to your question), you can just compare the new current time with your previous time and stop the countDown:
if((System.currentTimeMillis() - timeBeforeLaunchCountDown) > 5000){
myCountDown.cancel();
}