java.lang.Object | |
↳ | android.os.Looper |
Class Overview
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
类用于运行一个消息循环的线程。默认情况下,没有一个消息循环的线程;去创建一个,用prepare()方法调用线程运行循环,然后用loop()方法来处理消息,知道循环被停止。绝大部分的信息循环交互通过Handler类来完成。
这是一个典型的循环线程实现的案例,运用prepare()和loop()方法来创建一个初始的处理程序进行处理。