Kevin J. Brooks wrote: > This is what I need. I need to allow the user to continue to work at > the same time I need to run one of my methods every 60 seconds. I > looked at TimerTask, but I am not sure it this will do the job. I tried > to implement TimerTask but the compiler didn't like it.
TimerTask definitely works in Android, if that is what your question is. That being said, I would only use TimerTask in an activity, and then you will need to be sure to shut down the timer in onDestroy(), lest you leak an implicit background thread. You can also use Handler#postDelayed() to post messages to yourself on 60-second intervals. This involves less code than does TimerTask. To see an example of this, visit: http://commonsware.com/AdvAndroid/ and download the source code. In the ZIP file, you will see a ListView/HeaderFooter project that, among other things, demonstrates using a Handler to set up a timer-style system. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Warescription: Three Android Books, Plus Updates, $35/Year --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

