D
D
Danil Ochagov2018-08-26 18:04:35
Java
Danil Ochagov, 2018-08-26 18:04:35

Handler delays incorrectly. How to make a real time delay?

I make a stopwatch and decided to do it through the handler (chronometr? I don’t want to do my own), and it turned out that he makes the delay wrong, if he checks with the stopwatch on the phone, then it is a little faster, and after 30 seconds it overtakes by 1-2 seconds, etc. .e
Why is that? And how can you make the right delay? I need a delay of 100 milliseconds, but 10 is better if possible.
I have it at 100 - handler.postDalayed(startRun, 100);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2018-08-26
@red-barbarian

time must be measured by the clock. the handler is only needed to update the view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question