Hey, I want to replace Android’s `Timer.schedule` ...
# coroutines
m
Hey, I want to replace Android’s
Timer.schedule
(one time delayed execution) with coroutines, is there a better way than just launching a coroutine and calling delay() at the beginning? With structured concurrency, it would be able to get cancelled the same way than with cancelling the Timer, right?
a
Why do you need to use it with coroutines? Timer and coroutines are two differenc concepts and it is better not to mix them
m
I don’t want to use it with coroutines, I want to replace my Timer code with coroutine code but get the same behavior
s
@maxmello in short, the answer to your question is "yes" :)
v
it should be fine. also never used
Timer.schedule
on Android but rather
Handler.postDelayed
m
Ok, thank you 🙂