Timer Schedule
import java.util.Timerimport kotlin.concurrent.scheduleTimer().schedule(5000) { // do something}
Kotlin Coroutines Delay
// launch in background threadlaunch(Dispatchers.Default) { delay(5000L) // do something}
// launch in main/ui threadlaunch(Dispatchers.Main) { delay(5000L) // do something}
NOTE: Refer Kotlin Coroutines Delay Job or Setup Android Kotlin Coroutines (1.1) With Coroutine Scope.