下面用UI线程编写的代码
Handler handler
HandlerThread thread = new HandlerThread("SquareHandlerThread");
thread.start(); // starts the thread.
Looper looper = thread.getLooper();
//在UI线程中编写的代码下面并使用HandlerThread的looper
handler = new Handler(looper)
{
public void handleMessage(Message msg)
{
// do something
}
};
//我使用的其他一些线程我可以访问上面创建的处理程序的引用
hadler.sendMessage(messageObject)
现在的问题是在HandlerThread创建的mainthread或单独的线程中处理哪些线程消息(它为处理程序提供了looper)?