【发布时间】:2018-12-17 14:35:48
【问题描述】:
代码:
var shouldStopLoop = false
val handler = object : Handler()
val runnable = object: Runnable //error occurs here
{
override fun run() {
getSubsData()
if(!shouldStopLoop)
{
handler.postDelayed(this, 5000)
}
}
}
handler.post(runnable)
在我尝试创建val runnable 时发生Expecting a class body 错误。
【问题讨论】:
标签: android kotlin runnable android-handler