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

1581 questions
266
votes
3 answers

How to write a countdown timer in JavaScript?

Just wanted to ask how to create the simplest possible countdown timer. There'll be a sentence on the site saying: "Registration closes in 05:00 minutes!" So, what I want to do is to create a simple js countdown timer that goes from "05:00" to…
Bartek
  • 2,711
  • 3
  • 10
  • 5
199
votes
17 answers

How to convert milliseconds to "hh:mm:ss" format?

I'm confused. After stumbling upon this thread, I tried to figure out how to format a countdown timer that had the format hh:mm:ss. Here's my attempt - //hh:mm:ss String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(millis), …
mre
  • 40,416
  • 33
  • 117
  • 162
52
votes
12 answers

Android: CountDownTimer skips last onTick()!

Code: public class SMH extends Activity { public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main); TextView tv = (TextView) findViewById(R.id.tv); new CountDownTimer(10000,…
36
votes
5 answers

How to create a simple countdown timer in Kotlin?

I know how to create a simple countdown timer in Java. But I'd like to create this one in Kotlin. package android.os; new CountDownTimer(20000, 1000) { public void onTick(long millisUntilFinished) { mTextField.setText("seconds…
Andy Fedoroff
  • 26,838
  • 8
  • 85
  • 144
30
votes
8 answers

Android: How to pause and resume a Count Down Timer?

I have developed a Count Down Timer and I am not sure how to pause and resume the timer as the textview for the timer is being clicked. Click to start then click again to pause and to resume, click again the timer's text view. This is my code: …
Mineko
  • 573
  • 2
  • 13
  • 21
27
votes
1 answer

CountDown Timer ios tutorial?

I'm making an application where the exams is going on, so when exam start the, time should start with that. For example 30 minutes and it should reduce like 29:59. How can I implement this? Can anyone please give me a sample example or a easy step…
zeeshan shaikh
  • 819
  • 3
  • 18
  • 33
23
votes
4 answers

How to stop CountDownTimer in android

How to stop this timer , any idea ? I want to reset timer in every query but it continues. Every new query it adds new timer. How to solve this? new CountDownTimer(zaman, 1000) { //geriye sayma public void…
Taha
  • 287
  • 1
  • 3
  • 9
22
votes
8 answers

Display a countdown for the python sleep function

I am using time.sleep(10) in my program. Can display the countdown in the shell when I run my program? >>>run_my_program() tasks done, now sleeping for 10 seconds and then I want it to do 10,9,8,7.... is this possible?
user1681664
  • 1,533
  • 8
  • 23
  • 50
20
votes
3 answers

Checking if CountDownTimer is running

Ive been looking to see a method to see if a CountDownTimer is running or not, but I cant find a way to, any help would be greatly appreciated if (position == 0) { mCountDown = new CountDownTimer((300 * 1000), 1000) { public void…
user3224105
  • 237
  • 1
  • 2
  • 7
18
votes
3 answers

Circular Progress Bar ( for a countdown timer )

Ok so I have a countdown timer of 15 seconds that works perfectly fine and I'd like to make a custom circular progress bar for that timer. I want to create a full circle that gets "slices of the pie (circle)" taken out as the timer goes down until…
David Baez
  • 1,068
  • 1
  • 11
  • 24
17
votes
4 answers

How to handle multiple countdown timers in ListView?

I have a listview (with a custom list adapter), I need to display a countdown on every row. For example, if my list contains 4 items, I will have 4 rows. At this point, I need to handle 4 different countdowns (one for each row) because time is…
Rob
  • 708
  • 2
  • 6
  • 16
16
votes
2 answers

Countdown timer in HH:MM:SS format in Android

I am trying to develop a countdown timer in android. In this example I am entering a number of minutes as a parameter which is shown in a countdown timer. The problem is that when I am entering minutes, for example 65, then the counter will be…
15
votes
2 answers

Angular 2 - Countdown timer

I am willing to do a countdown timer in Angular 2 that start from 60 (i.e 59, 58,57, etc...) For that I have the following: constructor(){ Observable.timer(0,1000).subscribe(timer=>{ this.counter = timer; }); } The above, ticks every second,…
Folky.H
  • 1,052
  • 4
  • 14
  • 29
14
votes
3 answers

Multiple count down timers in RecyclerView flickering when scrolled

I have implemented count down timer for each item of RecyclerView which is in a fragment activity. The count down timer shows the time remaining for expiry. The count down timer is working fine but when scrolled up it starts flickering. Searched a…
Hasan shaikh
  • 688
  • 1
  • 5
  • 16
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…
1
2 3
99 100