I’m struggling to find documentation for the TimerTask function on Android.
I need to run a thread at intervals using a TimerTask but have no idea how to go about this.
Any advice or examples would be greatly appreciated.
I’m struggling to find documentation for the TimerTask function on Android. I need to
Share
You use a
Timer, and that automatically creates a new Thread for you when you schedule aTimerTaskusing any of theschedule-methods.Example:
This creates a Timer running
myTimerTaskin a Thread belonging to that Timer once every second.