core-ktx / androidx.os / android.os.Handler

Extensions for android.os.Handler

postAtTime

fun Handler.postAtTime(uptimeMillis: Long, token: Any? = null, action: () -> Unit): Runnable

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

postDelayed

fun Handler.postDelayed(runnable: Runnable, token: Any?, delayInMillis: Long): Unit

Version of Handler.postDelayed which adds the ability to specify token, enabling the use of Handler.removeCallbacksAndMessages.

fun Handler.postDelayed(delayInMillis: Long, token: Any? = null, action: () -> Unit): Runnable
fun Handler.postDelayed(amount: Long, unit: TimeUnit, token: Any? = null, action: () -> Unit): Runnable
fun Handler.postDelayed(duration: Duration, token: Any? = null, action: () -> Unit): Runnable

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