public final class HandlerUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkThreadAccess(android.os.Handler handler)
Checks whether the current thread is the same thread that the
Handler is associated
with. |
static void |
postAndWait(android.os.Handler handler,
java.lang.Runnable r)
Synchronously executes a
Runnable on the thread that this Handler is associated with. |
static <V> V |
postAndWait(android.os.Handler handler,
UncheckedCallable<V> c)
Synchronously executes an
UncheckedCallable on the thread that this Handler is
associated with, and returns its result. |
static void |
verifyThreadAccess(android.os.Handler handler)
Enforces that the current thread is the same thread that the
Handler is associated
with. |
public static boolean checkThreadAccess(android.os.Handler handler)
Handler is associated
with.Handler is associated
with; otherwise false.public static void verifyThreadAccess(android.os.Handler handler)
Handler is associated
with.java.lang.IllegalStateException - if the current thread is not the same thread that the
Handler is associated with.public static <V> V postAndWait(android.os.Handler handler,
UncheckedCallable<V> c)
UncheckedCallable on the thread that this Handler is
associated with, and returns its result.V - the return type of the UncheckedCallablec - the UncheckedCallable to executeUncheckedCallable.call()java.lang.RuntimeException - if the UncheckedCallable could not be executed (the cause
will be null), or if UncheckedCallable.call() threw an exception (the cause will be the
exception that it threw).public static void postAndWait(android.os.Handler handler,
java.lang.Runnable r)
Runnable on the thread that this Handler is associated with.r - the Runnable to executejava.lang.RuntimeException - if the Runnable could not be executed (the cause will be
null), or if Runnable.run() threw an exception (the cause will be the exception that
it threw).