I want to send from another handler (not from the LooperThread mhandler itself) to the LooperThread 's message queue, but it does not show anything.
The thread.sleep is to initiate the mHandler.
Any ideas?
Main Activity
new LooperThread().start();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Handler handler = new Handler(LooperThread.mHandler.getLooper());
handler.sendEmptyMessage(3);
LooperThread
class LooperThread extends Thread {
static Handler mHandler;
public void run() {
Looper.prepare();
mHandler = new Handler() {
public void handleMessage(Message msg) {
Log.d("LooperThread","handleMessage");
}
};
Looper.loop();
}
}