0

I am trying to put a Countdown timer using a TextView inside my Android studio project. I have been looking at other posts but I haven't been getting any good information. I want the simplest way to make an easy Countdown timer. Thanks in advance!

Countdown Timer:

CountDownTimer Count = new CountDownTimer(5000, 1000) {
                @Override
                public void onTick(long millisUntilFinished) {

                    timerText.setText("Seconds remaining: " + ((millisUntilFinished/ 1000) ));
                }
                @Override
                public void onFinish() {
                    timerText.setText("Time Done...");
                }
            };
            Count.start();
CodingM
  • 350
  • 3
  • 18
  • https://stackoverflow.com/a/7966996/7427111 – Dhaval Jardosh Feb 10 '18 at 01:01
  • Please post the code that you are using and also the logcat by editing the question. – Dhaval Jardosh Feb 10 '18 at 01:17
  • [**Github Link for Timer**](https://github.com/dhavaljardosh/Android-Studio-Projects/blob/master/EggTimer/app/src/main/java/com/example/jardosh/eggtimer/MainActivity.java), check if you can get some help from here. – Dhaval Jardosh Feb 10 '18 at 01:19
  • `'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference`, this means you are trying to set text to something which is not referenced properly. Show your java code as well. – Dhaval Jardosh Feb 10 '18 at 01:25
  • Oops! I just noticed, i havent assigned my TextView Sorry guys! – CodingM Feb 10 '18 at 01:30
  • @Dhaval Jardosh And also, another error, my timer simply just displays "time" without me assigning it, Im going to show my whole java class. But I am no longer getting a NullPointerExexption – CodingM Feb 10 '18 at 01:34

0 Answers0