zoukankan      html  css  js  c++  java
  • 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.

    参考

    http://web.mit.edu/majapw/MacData/afs/sipb/project/android/docs/reference/android/os/Handler.html#handleMessage(android.os.Message)

  • 相关阅读:
    实验二
    个人简介及对未来的想法
    读《构建之法》心得体会
    作业2
    个人简介
    第六次作业
    第二次作业
    个人简历
    购物系统测试缺陷报告
    读《构建之法》心得体会
  • 原文地址:https://www.cnblogs.com/xuanyuanchen/p/7404841.html
Copyright © 2011-2022 走看看