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);
  }
}

Leave a Comment