In Java (android), what is a good way to create accurate consecutive timers? : <p>What would be the most accurate solution to have multiple consecutive timers in Java / android? Or in other words, what is the best option to delay the next piece of code until the current timer has finished?</p>

<p>Background information if the question is unclear:
To practice coding, I would like to create a free app w/o ads to help practice freediving. The basic idea is to have several timers that run after each other. Example:</p>

<ol>
<li>2 minutes breath up</li>
<li>hold your breath for 2 minutes</li>
<li>2 minutes breath up</li>
<li>hold your breath for 2 minutes + 15 seconds</li>
<li>2 minutes breath up</li>
<li>hold your breath for 2 minutes + 15 seconds + 15 seconds
and so on; usually 8 rounds of breath holding which leads to 16 consecutive timers</li>
</ol>

<p>At first I thought I can use the timer class but I don't know how to pause the code until the timer is finished. So all the timers ran simultaneously. 
I have read about CountDownLatch and Handler but I don't have enough experience to judge what would be best for my purpose. I did a python version before and used sleep. It worked fine, but for longer timers it was inaccurate by a few seconds which is a problem. </p>

<p>Another option, I believe, is to use a regular timer but run a while loop until the displayed text == 0. I don't know if this infinite loop would crash the application, interfere with the timer's accuracy or has any other negative side effects.</p>

<p>Any help / thoughts would be appreciated. Thanks!</p>
