Timer skipping on Nexus device running 4.2

I have recording functionality in my application. I'm using a handler with refresh rate of 1000ms to update the handler for timer. Its working fine with no skipping of seconds in all devices except in Nexus device running 4.2. How could I fix this?

Jon Skeet
people
quotationmark

If you've got a timer updating every 1000ms, then if it happens to take a bit more than 1000ms between calls and you're unlucky enough to be close to a second boundary, then you would see it "skip" a second sometimes. For example, suppose it actually took 1005ms between calls, you could end up with:

06:31:04.993
06:31:05.998
06:31:07.003 // We've skipped 06:31:06
06:31:08.008

The simplest fix for this is just to make the timer fire more often - for example, every 100ms instead of every 1000ms. You may want to optimize this to avoid repeated string formatting for the same value, but you'd "notice" the second changing much more consistently.

people

See more on this question at Stackoverflow