0

My question is for an Androip App. I am planning to use several timers and they will change the textviews' values once per second. But when I use CountDownTimer, textviews become unsynchronized. How can I create an exact timer that won't delay and I can see every textview change at the same time?

1 Answers1

-1

Create a timer in a thread like this:

for(;;){
long startTime = System.nanoTime();    
while(System.nanoTime() - startTime<1000000000){//1000000000ns = 1s
    //Wait or sleep(0)
}
System.out.println("Action!");//Call your action here
}
Tokazio
  • 516
  • 2
  • 18