I am working in java android platform. I am creating a child thread from main thread. I want to stop child thread as my requirments. My child thread has simple function which doesn't have any loop. I want to kill child thread and free resources it is using, whenever I want. I searched for it and I found inturrupt() function. My thread is:
public class childThread implements Runnable{
public void run() {
firstFunction();
secondFunction();
}
}
Main thread has this code to start above thread:
Thread tChild;
tChild = new Thread(new childThread(), "Child Thread");
tChild.start();
My run()
function is calling function like this. How to I use interrupt()
in this? Please tell me any other way to kill child thread and deallocating its resources.