Android.OS.Looper Class
Class used to run a message loop for a thread.

See Also: Looper Members

Syntax

[Android.Runtime.Register("android/os/Looper", DoNotGenerateAcw=true)]
public class Looper : Java.Lang.Object

Remarks

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();
      }
  }

[Android Documentation]

Requirements

Namespace: Android.OS
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1