+ 2

Timer code in android java

how I can create a timer in android java?!

31st Dec 2016, 7:48 PM
Alireza
2 ответов
+ 1
you can define a runnable with the code you want and post it to a handler with delay. and inside that runnable you can post it to the handler again until the timer stops. see this page : http://stackoverflow.com/questions/4591149/create-a-simple-digital-timer-in-android
1st Jan 2017, 10:19 PM
ehsan-black
ehsan-black - avatar
+ 1
timer run your code in thread and if you want change UI element you shod use handler or guirunnable interface
3rd Mar 2017, 7:39 PM
Mehdi
Mehdi - avatar