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;

    protected void onCreate(Bundle savedInstanceState) {

        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() {


Recommended Answers

All 2 Replies

My old solution was 2 timers not one. I fire the timer that will later start the second one. The first timer disables itself after it enabled the second timer.

Thanks! Will look into that solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.