I know there is a post like this but it does not answer the question clearly.
I have a little game where you tap a head and it moves to a random position and you get +1 to score. Meanwhile there is a timer counting down from 60000 (60 seconds) and displaying below.
How can I make it so whenever the head is tapped, it adds a second to the timer?
new CountDownTimer(timer, 1) {
public void onTick(long millisUntilFinished) {
textTimer.setText("Timer " + millisUntilFinished/1000);
}
public void onFinish() {
Intent intent = new Intent(MainActivity.this, Gameover.class);
startActivity(intent);
}
}.start();
and in the onClickListner event I have:
timer=timer+1000;
It currently doesn't work as in there is no time added on the click.
Any help would be appreciated :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…