How to create a Looper thread, then send it a message immediately?
问题 I have a worker thread that sits in the background, processing messages. Something like this: class Worker extends Thread { public volatile Handler handler; // actually private, of course public void run() { Looper.prepare(); mHandler = new Handler() { // the Handler hooks up to the current Thread public boolean handleMessage(Message msg) { // ... } }; Looper.loop(); } } From the main thread (UI thread, not that it matters) I would like to do something like this: Worker worker = new Worker();