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
13
votes
5 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
  • 549
  • 1
  • 4
  • 11
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
  • 5
  • 27
11
votes
4 answers

How to use timer in C?

What is the method to use a timer in C? I need to wait until 500 ms for a job. Please mention any good way to do this job. I used sleep(3); But this method does not do any work in that time duration. I have something that will try until that time to…
user2332426
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,843
  • 2
  • 20
  • 41
9
votes
3 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
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
  • 874
  • 1
  • 19
  • 52
9
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
  • 6,261
  • 11
  • 73
  • 129
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,955
  • 15
  • 36
8
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
  • 6,250
  • 20
  • 61
  • 113
8
votes
1 answer

Problems To Cancel A CountDownTimer Android Java

When I close my app by pressing the BACK button (onBackPressed() called), the CountDownTimer doesn't stop, until it is done with counting. How can I put the CountDownTimer cancel(); in my onBackPressed()? Because, when I quit my application (shown…
KD-21
  • 255
  • 2
  • 5
  • 15
8
votes
2 answers

Taking pictures in android every 5 seconds

Using the camera API, i am able to successfully take a picture and save it to a folder. Here is the code that i am using: Main.xml:
user2262955
  • 281
  • 1
  • 3
  • 11
7
votes
7 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
  • 267
  • 1
  • 3
  • 13
7
votes
4 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
  • 73
  • 1
  • 1
  • 4
7
votes
4 answers

ListView with Coundown timer. Timer flickers when scrolling the listview

In my app, I have to show countdown timer for every item in listview. I have been able to do this using CountDownTimer. But, problem is when scrolling the listview up or down, timer starts flickering. Searched a lot but couldn't got a solution. My…
Nitish
  • 2,947
  • 11
  • 41
  • 74
7
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…