hi mate i have a thread that use looper. in the looper when he receive message , he call a blocking method (style read socket). How can can write method StopThread to stop this thread to terminate him ? have i to call quit on Handler or interrupt to thread ?
this is the code:
class LooperThread extends Thread {
public Handler mHandler;
public void run() {
Looper.prepare();
mHandler = new Handler() {
public void handleMessage(Message msg) {
try{
blocking call read
}catch(Interrupet Exception e) { }
}
};
Looper.loop();
}
public void stopThread(){ ??? }
}
Call
to interrupt the thread.
Edit: You will have to post a runnable on the thread.