HandlerKt

Added in 1.1.0

public final class HandlerKt


Summary

Public methods

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

Version of Handler.postAtTime which re-orders the parameters, allowing the action to be placed outside of parentheses.

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

Version of Handler.postDelayed which re-orders the parameters, allowing the action to be placed outside of parentheses.

Public methods

postAtTime

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

Version of Handler.postAtTime 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.

Object token

An optional object with which the posted message will be associated.

@NonNull Function0<Unit> action

The action that will be executed.

Returns
@NonNull Runnable

the created Runnable

postDelayed

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

Version of Handler.postDelayed which re-orders the parameters, allowing the action to be placed outside of parentheses.

handler.postDelayed(200) {
doSomething()
}
Returns
@NonNull Runnable

the created Runnable