4
如何创建Looper线程,然后立即向其发送消息?
我有一个工作线程位于后台,用于处理消息。像这样: 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(); } } 从主线程(UI线程,没关系),我想做这样的事情: Worker worker = …