How to call a function after delay in Kotlin?

前端 未结 11 1932
南笙
南笙 2020-11-30 19:07

As the title, is there any way to call a function after delay (1 second for example) in Kotlin?

11条回答
  •  旧巷少年郎
    2020-11-30 19:55

    There is also an option to use Handler -> postDelayed

     Handler().postDelayed({
                        //doSomethingHere()
                    }, 1000)
    

提交回复
热议问题