-1

Recently I’m working on a stopwatch that counts milliseconds too. I read articles that it is not necessary to update the timer TextView more than every 1/10th of a second , since that’s the time our eyes can register a image . Is this how every stopwatch app works ? Even the inbuilt stopwatch on all android devices ?

If the app can be made accurate to display every millisecond , suggest a method for it as I’m stuck .

weston
  • 54,145
  • 21
  • 145
  • 203
Deeraj Theepshi
  • 183
  • 3
  • 10

2 Answers2

1

I've developed one of the leading stopwatches on Android and the advice to update the running display 1/10 second max precision is correct. No point in updating screen for an unreadable value... doing so will only make your UI laggy.

I would also recommend:

  • Capturing the system time as the first action in your event listeners.
  • Fire events on button touched rather than button pressed. For millisecond precision it has to be first contact.
  • Use an event based persistence model.
Moog
  • 11
  • 1
0

If you update the textview too frequently it will be an unreadable blur. I cannot speak for all stopwatch apps (no one can), but I can say that what I have seen is apps that display:

0.1
0.2
0.3
0.4
0.5

Then only when you stop the timer do you see the full millisecond value:

0.5432

There is no benefit to displaying all those decimal places while the timer is running.

Also, note that there is no way to display every ms value while running as screen refresh rates are usually limited to 60 fps.

weston
  • 54,145
  • 21
  • 145
  • 203