It is required to periodically and independently from each other change the parameters of the view-elements (the text on the buttons). For this purpose, used Timer
and TimerTask
. Everything is working. But I created a lot of Timer
and TimerTask
: for each button (10 pieces). Timers are started for each button simultaneously. As I understand it, 10 separate threads are created and this is not good? Is there any need to optimize the program architecture in this case, for example, to use ExecutorService
to create a pool or something else? Or is my implementation optimal?
And another question: how to use ExecutorService
with Timer
and TimerTask
? Nowhere found examples of their sharing.