Reputation: 6108
Many Android game examples utilize a Thread to run a game engine on a particular interval. However, I've seen some other examples that use a TimerTask to run the game engine interval as well. I'm curious as to what other developers think the pros and cons of each approach are.
Upvotes: 4
Views: 638
Reputation: 48559
Timertask is a wrapper for a thread that provides a callback to the main thread allows you to schedule the running of a runnable sometime in the future. They have fairly different use cases. If you need to run code now, then use a thread, if you need to schedule something to run in the future, use timertask.
Edit: My mistake, was thinking of a different class. Fixed
Upvotes: 2