# HandlerKt

Added in 1.1.0

*** ** * ** ***


```
public final class HandlerKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html` | `https://developer.android.com/reference/androidx/core/os/HandlerKt#(android.os.Handler).postAtTime(kotlin.Long,kotlin.Any,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Handler.html receiver, long uptimeMillis, https://developer.android.com/reference/java/lang/Object.html token, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action )` Version of `https://developer.android.com/reference/android/os/Handler.html#postAtTime(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html` | `https://developer.android.com/reference/androidx/core/os/HandlerKt#(android.os.Handler).postDelayed(kotlin.Long,kotlin.Any,kotlin.Function0)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/os/Handler.html receiver, long delayInMillis, https://developer.android.com/reference/java/lang/Object.html token, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action )` Version of `https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses. |

## Public methods

### postAtTime

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Handler.kt+function:postAtTime) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull Runnable postAtTime(
    @NonNull Handler receiver,
    long uptimeMillis,
    Object token,
    @NonNull Function0<Unit> action
)
```

Version of `https://developer.android.com/reference/android/os/Handler.html#postAtTime(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses.

```
handler.postAtTime(200) {
    doSomething()
}
```

| Parameters |
|---|---|
| `long uptimeMillis` | The absolute time at which the callback should run, using the android.os.SystemClock#uptimeMillis time-base. |
| `https://developer.android.com/reference/java/lang/Object.html token` | An optional object with which the posted message will be associated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function0<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> action` | The action that will be executed. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html` | the created Runnable |

### postDelayed

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Handler.kt+function:postDelayed) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull Runnable postDelayed(
    @NonNull Handler receiver,
    long delayInMillis,
    Object token,
    @NonNull Function0<Unit> action
)
```

Version of `https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses.

```
handler.postDelayed(200) {
    doSomething()
}
```

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Runnable.html` | the created Runnable |