翻译Message、MessageQueue

public final class

Message

extends Object
implements Parcelable
java.lang.Object
   ↳android.os.Message

Class Overview


Defines a message containing a description and arbitrary data object that can be sent to a Handler. This object contains two extra int fields and an extra object field that allow you to not do allocations in many cases.

While the constructor of Message is public, the best way to get one of these is to call Message.obtain() or one of the Handler.obtainMessage() methods, which will pull them from a pool of recycled objects.

public final class

MessageQueue

extends Object
java.lang.Object
   ↳android.os.MessageQueue

Class Overview


Low-level class holding the list of messages to be dispatched by a Looper. Messages are not added directly to a MessageQueue, but rather through MessageQueue.IdleHandler objects associated with the Looper.

You can retrieve the MessageQueue for the current thread with Looper.myQueue().

译文:

定义一个消息包含一个描述和任意的数据对象,可以发送到处理程序。这个对象包含两个额外的int类型和一个额外的object雷翔允许你在许多情况下不分配。

当消息的贡枣函数是公共的,最好的途径之一就是去调用Message.obtain()或者一个Handler.obtainMessage()方法,这将把他们从池中回收对象。


Low-Level类列出了消息列表通过Looper被发送。消息不是MessageQueue直接添加,二回通过与Looper相关的MessageQueue.IdleHandler对象。

您可以检索当前线程的消息队列通过 Looper.myQueue()方法。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值