As Krish mentioned, you cannot reuse the TimerTask. If you want to, however, you can use Runnable
instead of TimerTask and execute it with a ScheduledExecutorService
. See this answer for an example.
↧
Answer by Cardinal System for IllegalStateException when trying to schedule a timer
↧