Ben Williamson wrote: > I ran across someone else using sleep and a boolean flag to set the > thread suspended, will this method work with the Activity structure that > is in Android. Can I set a flag and tell my thread to sleep while in > onPause?
Thread.sleep() is for a fixed period of time. This means the thread will keep waking up if the activity is not yet resumed, and the thread will stay asleep even after the activity is resumed (until the time period ends). I recommend you spend a bit of time getting spun up on Java concurrency if you're going to be using background threads significantly. You might consider _Java Concurrency in Practice_, or at least some of the material on that book's wiki: http://artisans-serverintellect-com.si-eioswww6.com/default.asp?W1 Or, anything else you can find by Doug Lea, patron saint of Java threads. -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Published! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

