Questions tagged [countdowntimer]

The Android `CountDownTimer` class. Do not use this tag for any countdown timer-related question that is not related to the Android class

The Android CountDownTimer class. This class allows scheduling a task in Android. The task can be one-shot-executed or executed in defined time intervals.

Do not use this tag for any countdown timer-related question that is not related to the Android class

1696 questions
16
votes
6 answers

Javasacript Countdown timer in Days, Hours, Minute, Seconds

I'm trying to create a time-based count down clock. It is not based upon current_dates. The initial time that will be pulled will be from a separate php file. This will be for a browser based-game. When someone clicks the button to initiate this…
Phoenix Ryan
  • 679
  • 1
  • 5
  • 11
13
votes
2 answers

How to display countdown timer on status bar in android, like time display?

I am making an app which allows the user to pick a date and time. Once the date and time are reached,it will display an animation on the screen. Before its time, it will just show countdown time (like xxx:xx:xx) on screen. I achieved this using a…
12
votes
3 answers

Handler.postDelayed(Runnable) vs CountdownTimer

Sometimes we need to delay a code before it runs. This is doable by the Handler.postDelayed(Runnable) or CountdownTimer. Which one is better in terms of performance? See the sample code below Handler new Handler().postDelayed(new…
JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
12
votes
3 answers

Is it possible to add a timer to the actionbar on android?

I'd like a simple mm:ss timer to be displayed on my actionbar, be able to pick the number of minutes to start counting down from and then call a method once it's at 0. Is this possible and how?
Omair Vaiyani
  • 552
  • 7
  • 28
12
votes
4 answers

Implementing a loop using a timer in C#

I wanted to replace a counter based while loop with the timer based while loop in C#. Example : while(count < 100000) { //do something } to while(timer < X seconds) { //do something } I have two types of timers in C# .NET for this…
Raulp
  • 7,758
  • 20
  • 93
  • 155
10
votes
4 answers

android countdowntimer tick is not accurate

I am using a countdown timer for audio notification... and it's not accurate from the start... using initial parameters private final long startCountDown; private final long intervalCountDown; ... startCountDown = 180 * 1000; // 3 mns -…
user762579
9
votes
1 answer

How to make a count down timer in Notification's view?

I figured out how to make custom views using RemoteViews class. I also know how to use Chronometer and ProgressBar inside of RemoteViews. But how to make a count down View, almost exactly the same as Chronometer but with the difference that it will…
Michal Chudy
  • 1,883
  • 2
  • 21
  • 41
9
votes
8 answers

How to create an infinite loop

Ok,I need to create an infinite loop on a countdown. My code is: public void countdown() { if (x != null) { x.cancel(); } x = new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { } …
Milky Way
  • 287
  • 1
  • 3
  • 13
9
votes
2 answers

CountDownTimer: "Can't create handler inside thread that has not called Looper.prepare()"

I know the general problem of "Can't create handler inside thread that has not called Looper.prepare()" has been asked before, but I am struggling to understand how it applies in this case. I am trying to construct a new CountDownTimer in a non-UI…
skaz
  • 21,962
  • 20
  • 69
  • 98
9
votes
5 answers

How to keep a CountDownTimer running even if the app is closed?

I spent my summer learning how to code and building my first app (in android studio). Therefore I am not an expert coder. This week I encountered a problem. Basically, I am developing a quiz app and when the user gets the answer wrong he have to…
Fred
  • 93
  • 1
  • 1
  • 4
9
votes
2 answers

ListView and items with countdown timer

i have a issue with my Listview, i want to set a countdown timer to all ListView's items, and i allready have googled a solution for this, but it isn't work correctly. The Problem is that ListView reuses(recycling) a views, and i always get a wrong…
whizzzkey
  • 926
  • 3
  • 21
  • 52
8
votes
4 answers

Why won't my countdown timer start and stop?

I need to make a simple countdown timer from 5 to zero, with the buttons to START and STOP the counter. The only thing that I don't know is that why won't my counter stop. The code is presented below: function clock() { var myTimer =…
Tommi Tiihonen
  • 89
  • 1
  • 1
  • 6
8
votes
2 answers

Recyclerview with multiple countdown timers causes flickering

I want to show how much time is left inside each cell of my RecyclerView...for that I have used a countdown timer for each. In each row I start a counter and manage onTick()...all works as expected...I've got a timer tick for each row and my cell…
H Raval
  • 1,903
  • 17
  • 39
8
votes
1 answer

Countdown Timer Notification

I'm begginer in Android programming, I have to do a CountdownTimer that starts from a number selected by the user using a two number pickers (one for Hours and other for minutes). The characteristics must be: -The CountdownTimer must work in…
8
votes
3 answers

Android Dialog with CountDown TImer

In my app, I show the push notification as a Dialog that has two buttons named Yes and No. I need to show a timer (20 seconds) running in the dialog's title. If the user clicks Yes, it should go to an activity. If the user clicks No, the dialog…
user1799171
  • 567
  • 1
  • 3
  • 15