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

Android中的Looper對象詳細介紹

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

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


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)文章

最新評論

岑溪市| 买车| 屏东市| 苍南县| 白城市| 海晏县| 十堰市| 玉田县| 台东县| 拉孜县| 永靖县| 探索| 上犹县| 江城| 凤庆县| 贡觉县| 阆中市| 新安县| 师宗县| 凤台县| 石泉县| 金堂县| 仁怀市| 鄯善县| 壶关县| 汽车| 和硕县| 八宿县| 兰考县| 宁城县| 黎平县| 抚顺市| 新密市| 上林县| 鄂尔多斯市| 河东区| 靖西县| 芜湖县| 黄骅市| 基隆市| 南召县|