I used some thread objects in my Android activity. But these threads do not stop itself when Activity on destroy. My code for thread-stopping as following:
@Override
public void onDestroy() {
super.onDestroy();
thread.interrupt();
}
Above code is not only working for thread object stopping but also throws an InterruptedException. What's the correct way to stop a running thread without exceptions?
is it not an error when thread object throws InterruptedException?