Opóźnienie Kotlin
Timer().schedule(2000) {
TODO("Do somefing")
}
abdullah
Timer().schedule(2000) {
TODO("Do somefing")
}
// 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)
//Use Looper.getMainLooper() for avoid deprecation warning
Handler(Looper.getMainLooper()).postDelayed({
// Your Code
}, 3000)
Handler().postDelayed({
//doSomethingHere()
}, 1000)
Thread.sleep(10000) // Wait 10 sec