# AndroidUiDispatcher

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/AndroidUiDispatcher.android.kt+class:androidx.compose.ui.platform.AndroidUiDispatcher) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- android

  ```
  class AndroidUiDispatcher : CoroutineDispatcher
  ```

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [kotlin.coroutines.AbstractCoroutineContextElement](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-abstract-coroutine-context-element/index.html) |||
|   | ↳ | [kotlinx.coroutines.CoroutineDispatcher](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html) ||
|   |   | ↳ | [androidx.compose.ui.platform.AndroidUiDispatcher](https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher) |

*** ** * ** ***

A `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` that will perform dispatch during a `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#handler()` callback or `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#choreographer()`'s animation frame stage, whichever comes first. Use `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#Main()` to obtain a dispatcher for the process's main thread (i.e. the activity thread) or `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#CurrentThread()` to obtain a dispatcher for the current thread.

## Summary

| ### Public companion properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#CurrentThread()` The canonical `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` containing the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher` and its `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#frameClock()` for the calling thread. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#Main()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` containing the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher` and its `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#frameClock()` for the process's main thread. | android |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#dispatch(kotlin.coroutines.CoroutineContext,java.lang.Runnable)(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html, block: https://developer.android.com/reference/java/lang/Runnable.html)` | android |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/android/view/Choreographer.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#choreographer()` | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#frameClock()` A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock` associated with this `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher`'s `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#choreographer()` that may be used to await `https://developer.android.com/reference/android/view/Choreographer.html` frame dispatch. | android |

### Inherited functions

From [kotlin.coroutines.CoroutineContext](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html) `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/plus.html(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html)` android From [kotlin.coroutines.CoroutineContext.Element](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html) `open R` `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/fold.html(initial: R, operation: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html, R) -> R)` android `open operator E?` `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/get.html(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<E>)` android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/minus-key.html(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<*>)` android From [kotlinx.coroutines.CoroutineDispatcher](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-internal-coroutines-api/index.html
https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/dispatch-yield.html(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html, block: https://developer.android.com/reference/java/lang/Runnable.html)` android `final https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html<T>` `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/intercept-continuation.html(continuation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html<T>)` android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/is-dispatch-needed.html(context: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html)` android `open https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/limited-parallelism.html(parallelism: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` android `operator https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` `[plus](https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/plus.html)(other: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html)`

**This function is deprecated.** Operator '+' on two CoroutineDispatcher objects is meaningless.
android `final https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/release-intercepted-continuation.html(continuation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html<*>)` android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/to-string.html()` android

### Inherited properties

From [kotlin.coroutines.AbstractCoroutineContextElement](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-abstract-coroutine-context-element/index.html) `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-key/index.html<*>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-abstract-coroutine-context-element/key.html` android

## Public companion properties

### CurrentThread

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val CurrentThread: CoroutineContext
```

The canonical `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` containing the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher` and its `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#frameClock()` for the calling thread. Returns `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#Main()` if accessed from the process's main thread.

Throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` if the calling thread does not have both a `https://developer.android.com/reference/android/view/Choreographer.html` and an active `https://developer.android.com/reference/android/os/Looper.html`.

### Main

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Main: CoroutineContext
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/index.html` containing the `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher` and its `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#frameClock()` for the process's main thread.

## Public functions

### dispatch

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
open fun dispatch(context: CoroutineContext, block: Runnable): Unit
```

## Public properties

### choreographer

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val choreographer: Choreographer
```

### frameClock

android Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val frameClock: MonotonicFrameClock
```

A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/MonotonicFrameClock` associated with this `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher`'s `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/AndroidUiDispatcher#choreographer()` that may be used to await `https://developer.android.com/reference/android/view/Choreographer.html` frame dispatch.