delay start function in kotlin code example
Example 1: how to call a function after delay in kotlin android
// Android 10+ Handler() is depricated
// Import
import android.os.Handler;
import android.os.Looper
val handler = Handler(Looper.getMainLooper())
handler.postDelayed({
// do something after 1000ms
}, 1000)
Example 2: android kotlin set timerout
import java.util.Timer
import kotlin.concurrent.schedule
Timer("SettingUp", false).schedule(500) {
doSomething()
}