一.Handler 使用方法: 输出结果: 二.源码分析 又回到Handler.java 补充: UI线程 调用 Loop. 三.总结: 一.Handler,Looper,MessageQue三者关系 1.Looper:相当于消息的载体 1) 它的内部有一个消息队列,也就是MessageQueue, ...
分类:
移动开发 时间:
2018-07-07 13:54:37
阅读次数:
191
Handler、Loop、MessageQueue的工作原理:
先介绍一下这几个组件:
Message:Handler接收和处理的消息对象
Looper:读取MessageQueue中的消息,并将读到的消息发送给Handler进行处理
MessageQueue:消息存储队列。
程序使用Handler发送消息,被发送的消息必须被指定到MessageQue...
分类:
移动开发 时间:
2015-04-22 22:17:14
阅读次数:
247
我们首先来看HandlerThread的创建过程,public class HandlerThread extends Thread { @Override
public void run() {
mTid = Process.myTid();
Looper.prepare();
synchronized (this) {...
分类:
移动开发 时间:
2015-03-17 15:48:11
阅读次数:
176