android.os.Handler
android.os.handler
A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.
There are two main uses for a Handler: (1) to schedule messages and runnables to be executed as some point in the future; and (2) to enqueue an action to be performed on a different thread than your own.
The send message versions allow you to enqueue a Message object containing a bundle of data that will be processed by the Handler's handleMessage(Message) method (requiring that you implement a subclass of Handler).
中文:sendMessage类的函数将message插入message队列,然后Handler调用函数handleMessage()去处理。
public final boolean sendEmptyMessage (int what)
Sends a Message containing only the what value.
Returns true if the message was successfully placed in to the message queue. Returns false on failure, usually because the looper processing the message queue is exiting.
public void handleMessage (Message msg)
Subclasses must implement this to receive messages.
参考
android.os.Handler的更多相关文章
- ANDROID_MARS学习笔记_S04_009_用java.lang.ref.SoftReference作缓存,android.os.Handler和new Thread异步加载略图片
		一.简介 二.代码流程 1.private Map<String, SoftReference<Drawable>> imageCache = new HashMap<S ... 
- android.os.handler(转)
		android.os.handler相关知识整理 Handler在android里负责发送和处理消息.它的主要用途有: 1)按计划发送消息或执行某个Runnanble(使用POST方法): 2)从其他 ... 
- W/MessageQueue: Handler (android.os.Handler) {4241f8f8} sending message to a Handler on a dead thread
		缩略信息是: sending message to a Handler on a dead thread 我是用IntentService时报的 稍微纤细一点儿的信息是: Handler (andro ... 
- Android  测试Handler的基本使用
		package com.sherlock.app_handler; import java.io.ByteArrayOutputStream; import java.io.InputStream; ... 
- Android中Handler 、Thread和Runnable之间的关系
		在多线程编程的时候,我们经常会用到Handler,Thread和Runnable这三个类,我们来看看这三个类之间是怎么样的关系? 首先说明Android的CPU分配的最小单元是线程,Handler一般 ... 
- Android之Handler,举例说明如何更新UI
		方法一:(java习惯,在android不推荐使用) 刚刚开始接触android线程编程的时候,习惯好像java一样,试图用下面的代码解决问题 new Thread( new Runnable() { ... 
- Android之Handler用法总结(1)
		方法一:(java习惯,在android平台开发时这样是不行的,因为它违背了单线程模型) 刚刚开始接触android线程编程的时候,习惯好像java一样,试图用下面的代码解决问题 new Thread ... 
- Android之Handler用法总结
		方法一:(java习惯,在android平台开发时这样是不行的,因为它违背了单线程模型) 刚刚开始接触android线程编程的时候,习惯好像java一样,试图用下面的代码解决问题 new Thread ... 
- 【Android】Handler使用入门
		本讲内容:Handler使用入门 当用户点击一个按钮时如果执行的是一个常耗时操作的话,处理不好会导致系统假死,用户体验很差,而Android则更进一步,如果任意一个Acitivity没有响应5秒钟以上 ... 
随机推荐
- (转)关于三星cortex A9 Sate4412 开发板 uboot 启动的一些问题释疑
			说明:本文转载自:http://blog.csdn.net/gooogleman/article/details/17238079 作者:gooogleman 日 ... 
- perl 中的哈希赋值
			在perl 中,通过代码动态的给哈希赋值,是最常见的应用场景,但是有些情况下,我们事先知道一些信息,当需要把这些信息存放进一个哈希的时候,直接给哈希赋值就好: 哈希的key不用说,就是一个字符串,关键 ... 
- PHP 5种方式获取文件后缀名
			<?php header("content-type:text/html;charset=utf-8"); function get_ext1($filename) { re ... 
- js实现密码强度
			<!doctype html> <html> <head> <meta charset="utf-8"> <title> ... 
- mui自定义事件带参返回mui.back()
			父页面添加自定义监听事件:(e.detail.xxx) window.addEventListener('doit', function(e){ //获取参数值 var imagePath = e.d ... 
- 阿里巴巴Java开发规约插件-体验
			插件有哪些功能? 阿里技术公众号于今年的2月9日首次公布<阿里巴巴Java开发规约>,瞬间引起全民代码规范的热潮,上月底又发布了PDF的终极版,大家踊跃留言,期待配套的静态扫描工具开放出来 ... 
- 【RF库Collections测试】Create Dictionary
			Name:Create DictionarySource:Collections <test library>Arguments:[ *key_value_pairs ] 
- 批处理bat文件dos命令复制文件
			::将“C:\Users\ZZ\Desktop\快捷处理\我我我哦我”路径下的文件复制到“C:\Temp\我我我哦我”路径下::/S表示“复制目录和子目录,除了空的.”::/E表示“复制目录和子目录, ... 
- [笔试题]黑板上写下50个数字,选两个黑板上数字a和b,在黑板写|b-a|,剩下的数字?
			在黑板上写下50个数字:1至50.在接下来的49轮操作中,每次做如下操作:选取两个黑板上的数字a和b,擦去,在黑板上写|b-a|.请问最后一次动作之后剩下的数字可能是什么?为什么?(不用写代码,不写原 ... 
- resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced
			Maven在执行中报错: - Failure to transfer org.slf4j:slf4j-api:jar:1.7.24 from http://localhost:8081/nexus/c ... 
