Example usage for android.os Looper getMainLooper

List of usage examples for android.os Looper getMainLooper

Introduction

In this page you can find the example usage for android.os Looper getMainLooper.

Prototype

public static Looper getMainLooper() 

Source Link

Document

Returns the application's main looper, which lives in the main thread of the application.

Usage

From source file:Main.java

public static boolean checkMainThread() {
    return Looper.myLooper() == Looper.getMainLooper();
}

From source file:Main.java

public static boolean isMainThread() {
    if (Looper.myLooper() == Looper.getMainLooper()) {
        return true;
    }//  ww w  .j a v  a2  s  .c  o  m
    return false;
}

From source file:Main.java

public static boolean isMainThread() {
    return Thread.currentThread() == Looper.getMainLooper().getThread();
}

From source file:Main.java

public static boolean isRunInMainThread() {
    return Thread.currentThread() == Looper.getMainLooper().getThread();
}

From source file:Main.java

public static void runOnUi(Runnable task) {
    new Handler(Looper.getMainLooper()).post(task);
}

From source file:Main.java

public static boolean isUIThread() {

    return Looper.getMainLooper().getThread().getId() == Thread.currentThread().getId();

}

From source file:Main.java

public static void runOnUiThread(Runnable action) {
    new Handler(Looper.getMainLooper()).post(action);
}

From source file:Main.java

private static void checkMustInUiThread() {
    if (Looper.getMainLooper() != Looper.myLooper()) {
        throw new IllegalAccessError("this method must  call in ui thread!!");
    }//from  w  w w . j  a  v  a  2  s.  c  o m
}

From source file:Main.java

private static void scheduleOnMainThread(Runnable r) {
    new Handler(Looper.getMainLooper()).post(r);
}

From source file:Main.java

public static void runOnUiThread(Runnable runnable) {
    new Handler(Looper.getMainLooper()).post(runnable);
}