See Also: Looper Members
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 Looper.Prepare in the thread that is to run the loop, and then Looper.Loop to have it process messages until the loop is stopped.
Most interaction with a message loop is through the Android.OS.Handler class.
This is a typical example of the implementation of a Looper thread, using the separation of Looper.Prepare and Looper.Loop to create an initial Handler to communicate with the Looper.
java Example
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();
}
}