{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

AndroidUiDispatcher.Companion

public static class AndroidUiDispatcher.Companion


Summary

Public methods

static final @NonNull CoroutineContext

The canonical CoroutineContext containing the AndroidUiDispatcher and its frameClock for the calling thread.

static final @NonNull CoroutineContext

The CoroutineContext containing the AndroidUiDispatcher and its frameClock for the process's main thread.

Public methods

getCurrentThread

public static final @NonNull CoroutineContext getCurrentThread()

The canonical CoroutineContext containing the AndroidUiDispatcher and its frameClock for the calling thread. Returns Main if accessed from the process's main thread.

Throws IllegalStateException if the calling thread does not have both a Choreographer and an active Looper.

getMain

public static final @NonNull CoroutineContext getMain()

The CoroutineContext containing the AndroidUiDispatcher and its frameClock for the process's main thread.