Hi Brad,

> Can anyone tell me how to safely stop a thread?
> 

You can't stop a thread but you can let it die. Just return from the 
Thread#run method. Most of the time you will have something like:

public volatile boolean shutdownRequested = false;

public void run() {
   while (!shutdownRequested) {
     // ... do something ...
   }
}

Just set the shutdownRequested variable to true to quit the loop and 
stop the thread.

Regards,

Cyril

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to