I am trying to update a seekbar every second in background using Kotlin & Coroutines but It says Handler() is deprecated use it with looper and i am confused how to use handler, looper and kotlin coroutines
The code i tried to make it work
val myHandler: Handler = Handler()
myHandler.postAtTime(asyncSeekBar(), 1000)
Here showing Handler() is deprecated
asyncSeekBar()
private fun asyncsSeekBar() {
CoroutineScope(Default).launch {
updateSeekBar()
}
}
but asyncSeekBar should be Runnable therefore showing and error
Type mismatch. Required: Runnable Found: Unit
If there is any other way of doing it with more simpler way, please suggest