I want to know which is the best way to stop a thread in Android. I know I can use AsyncTask
instead of it and that there is a cancel()
method. I have to use Thread
s in my situation. Here is how I'm using Thread
:
Runnable runnable = new Runnable() {
@Override
public void run() {
//doing some work
}
};
new Thread(runnable).start();
So, does anyone have any idea of which is the best way to stop a thread?