Hello guys! I'm trying to create a countdown timer for a memory app. The user is given about 5-10 seconds to look at the gridview of pictures then the countdown timer starts. I was wondering how I can achieve this. The code below shows the countdown timer which starts at 30 seconds.
public class Play extends AppCompatActivity {
TextView tvTimer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play);
tvTimer = (TextView) findViewById(R.id.tv_timer);
CountDownTimer timer = new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
tvTimer.setText(" " + millisUntilFinished / 1000);
}
public void onFinish() {
tvTimer.setText("done!");
}
}.start();
}