最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android中的Looper對(duì)象詳細(xì)介紹

 更新時(shí)間:2014年02月13日 16:32:40   作者:  
這篇文章主要介紹了Android中的Looper對(duì)象,需要的朋友可以參考下

Java 官網(wǎng)對(duì)Looper對(duì)象的說明:


public class Looperextends Object
Class used to run a message loop for a thread. Threads by default do not have a message loop associated with them; to create one, call prepare() in the thread that is to run the loop, and then loop() to have it process messages until the loop is stopped.

Most interaction with a message loop is through the Handler class.

This is a typical example of the implementation of a Looper thread, using the separation of prepare() and loop() to create an initial Handler to communicate with the Looper.

復(fù)制代碼 代碼如下:

  class LooperThread extends Thread {
      public Handler mHandler;

      public void run() {
          Looper.prepare();

          mHandler = new Handler() {
              public void handleMessage(Message msg) {
                  // process incoming messages here
              }
          };

          Looper.loop();
      }
  }

主要方法:

static void loop() :  Run the message queue in this thread.
static void prepare() :  Initialize the current thread as a looper.

相關(guān)文章

最新評(píng)論

礼泉县| 石家庄市| 家居| 鲁甸县| 元江| 自贡市| 连城县| 南陵县| 连南| 新沂市| 通渭县| 贵溪市| 张家川| 兴国县| 元朗区| 平乡县| 确山县| 绥江县| 时尚| 彰化县| 宁陵县| 特克斯县| 延长县| 贺兰县| 依安县| 永吉县| 天气| 邛崃市| 罗田县| 湖南省| 揭东县| 丹棱县| 新田县| 增城市| 壶关县| 安顺市| 沭阳县| 保靖县| 伽师县| 福鼎市| 邵阳县|