I have a Handler and a runnable to be done in 3000ms when I touch the screen.
How can I display the time left to happen since I touched the screen?
Is there any way to display it on a textview
or something alike?
I have a Handler and a runnable to be done in 3000ms when I touch the screen.
How can I display the time left to happen since I touched the screen?
Is there any way to display it on a textview
or something alike?
Easiest way is to add a counter value and increase it by 1000. Then rather using postDelayed(3000)
you can use postDelayed(1000)
.
Every time the runnable is called, increase the counter with 1000 until it became the expected value (3000 in this case). Then do you work and return.