How do I kill an Android thread completely?
to kill the thread , i think you can do like this :
myService.getThread().interrupt();
NOTE : the method Thread.stop()
is deprecated
EDIT : : try this
public void stopThread(){
if(myService.getThread()!=null){
myService.getThread().interrupt();
myService.setThread(null);
}
}
The method Thread.stop()
is deprecated, you can use
Thread.currentThread().interrupt();
and then set thread=null
.