HandlerThread继承了Thread,在run()中通过Looper.prepare()创建了loop对象,并通过Looper.loop()开启了消息循环。新建的handler和HandlerThread的loop绑定在一起,handler处在一个子线程中,这样就能够执行一些耗时操作。IntentService中封装了HandlerThread和Handler。
HandlerThread继承了Thread,在run()中通过Looper.prepare()创建了loop对象,并通过Looper.loop()开启了消息循环。新建的handler和HandlerThread的loop绑定在一起,handler处在一个子线程中,这样就能够执行一些耗时操作。IntentService中封装了HandlerThread和Handler。