jtaylor wrote: > On Jan 20, 12:04 pm, Dave Sparks <[email protected]> wrote: >> Android is a message driven application framework. The message looper >> is the thread that reads messages queued for your application and >> calls the methods in your application based on the message context. By >> calling sleep, you effectively put your entire application to sleep >> for 10 seconds because it can't respond to any external messages >> coming from the framework. You never want to call sleep from any >> function that is called directly or indirectly by the framework. >> > > So never call Sleep in an Android Application?
Specifically, Mr. Sparks said never to call sleep from any spot where you were given control by the Android framework. So, for example, don't sleep in onCreate(), or onKeyDown(), or an event listener callback method, etc. That will give you the Android "application not responding" error. In principle, you can sleep in your own background threads that are totally under your control. In practice, I find that sleep() calls generally mean some sort of refactoring is in order, to have the background thread block on a queue or mutex or socket or something. -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

