Simple way to have a closure execute 250.milliseconds in the future? Looking for the Kotroid equivalent of the Swiftios
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(250)) {
Foo().makeABar()
}
m
Marko Mitic
10/28/2019, 9:11 PM
launch{
delay(250)
action()
}
btw, what is
Kotroid
?
t
Travis Griggs
10/28/2019, 9:17 PM
Kotlin <-> Android
This appears to be kolinx.coroutines thing? can/should I use that in an android environment?
:yes: 2
a
Adam Powell
10/28/2019, 11:08 PM
Yes, because structured concurrency makes it much easier to get cancellation right when your lifecycle scope is no longer valid