simonc wrote:
> Apparently the when you sleep() a thread it stops
> running for the time given.
That is the definition of sleep(). ;-)
> I'm using it to ensure that my internet connection isn't ever open for
> more than a minute something like this:
>
> while (true) {
> if (getConnectionOpenTime()>1minute) {
> closeConneection();
> }
> Thread.sleep()1000*60;
> }
>
> The connection gets re-opened elsewhere so this needs to keep looping.
If this is happening in an Activity, you can use View#postDelayed() to
schedule a Runnable to be executed after such-and-so delay.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android App Developer Books: http://commonsware.com/books.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---