Questions tagged [chronometer]

In Android, Chronometer is a class that implements a simple timer. Chronometer is a subclass of TextView. This class helps us to add a timer in our app. You can give Timer start time in the elapsedRealTime() timebase and it start counting from that. If we don’t give base time then it will use the time at which time we call start() method. By default a chronometer displays the current timer value in the form of MM:SS or H:MM:SS.

302 questions
2
votes
1 answer

Android Chronometer own implementation

I've developed an own implementation of a Chronometer. I did the follow: Create a Service (CronoService), that use a Runnable object that execute the thread. The Runnable will loop each 0.1 secs. Messenger Object that will receive messages from Ui…
gutiory
  • 1,135
  • 5
  • 13
  • 33
2
votes
0 answers

How to stop a chronometer from counting zero twice (-0 and +0)

I'm making a race timing app in Android Studio in kotlin that calculates a bunch of useful information off of split times. At the beginning of the race, bib 1 starts at 0, but bib 2 might start 15s later. I want the user to see each racer in a…
2
votes
1 answer

Android - Chronometer setBase() doesn't work properly

I found that if I call start() right after setBase(SystemClock.elapsedRealtime()) it will start counting from 00:00 (which is fine), see below: startButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View…
Sam Chen
  • 7,597
  • 2
  • 40
  • 73
2
votes
2 answers

chronometer not running in service

I am trying to run chronometer inside a Service. But I am not able to run it. I press a button in Activity and that event is passed to the Service. If the button in pressed then start the Chronometer but problem is setOnChronometerTickListener is…
sagar suri
  • 4,351
  • 12
  • 59
  • 122
2
votes
1 answer

Chronometer doesn't overwrite base value

When I call chronometer.start(), the chronometer starts counting but the base value (00:00) is still there and it is not overwritten. chronometer in my xml file looks like this
bezdyjoe
  • 63
  • 1
  • 5
2
votes
1 answer

Problems with setOnChronometerTickListener

so i was trying to mess around with android studio, and decided to make a simple counter app. Every time I press the button(which covers the entire screen) it adds 1, and if i keep the button pressed for 3 sec the counter resets. Simple as that. But…
Migaloco
  • 31
  • 7
2
votes
2 answers

Android Chronometer format hh:mm without seconds

I'm trying to create a chronometer in android, using android.widget.Chronometer, that displays only hours and minutes (hh:mm), but untill now I didn't find a way to make it. I don't even know if this is possible with this widget. Is this possible?…
Tiz
  • 413
  • 1
  • 5
  • 21
2
votes
1 answer

Chronometer is still running after calling stop?

I am trying to implement a chronometer with hour minute and seconds format. when I call stop the chronometer still keeps counting the time and gets added to it once I start the chronometer again. I also don't want the chronometer to be reset,…
2
votes
1 answer

Initialize chronometer with specific time JAVA

I have this time in seconds ( for example seconds = 2796 ) long seconds =2796; long millis = seconds * 1000; So I want my Chronometer to start at 46min 36sec I tried doing this: chronometer.setBase(myMillis); long seconds =2796; long…
exequielc
  • 681
  • 1
  • 11
  • 32
2
votes
2 answers

Why is this simple JavaScript stopwatch not working?

I wrote some very simple code the should represent a stopwatch with two buttons where clicking 'Start' should start counting upwards from 0 with 1 second delay. However, when I click nothing changes. Where is my mistake? "use strict"; var s =…
E Coder
  • 31
  • 6
2
votes
2 answers

Android chronometer ticks once and stops

I need to hide a TextView after 10 seconds. I thought I could implement a Chronometer and when elapsed time is bigger than 10000 millis I hide the TextView. My problem is that the chronometer only ticks once and then stops. Any idea what I've missed…
Alin
  • 14,809
  • 40
  • 129
  • 218
2
votes
1 answer

Text style on chronometer on android

How do I change the font ans font size on chronometer. When I align the chronometer with a textview it shows different size and settings. I also tried assigning font settings from…
pats
  • 1,273
  • 2
  • 20
  • 43
2
votes
1 answer

Chronometer doesn't start from 00:00:00

I have a problem with the chronometer. When I start it, it begins from 01:00:00. I don't know why. I think that my code is correct. Can you understand what the problem is? This is my code: Chronometer crono = new…
Deca
  • 153
  • 1
  • 11
2
votes
3 answers

Android: How to restore the state of a stopped chronometer after rotation?

I'm doing this way to save the state and restore it after rotation when the chronometer is running. Android_Chronometer pause When I stop the timer at Xsec and then after Y seconds I change the orientation the chronometer marks X+Y seconds. I'd like…
user3290180
  • 4,260
  • 9
  • 42
  • 77
2
votes
0 answers

Counter restarts after killing app

I have made an app that starts a counter when I hold the button, and stops counting as soon as I release the button, then start again as soon as I touch it again.. (The app is made to see how long time I can use, to touch a button.) Anyway, I have…
Leitvoll
  • 53
  • 4