The code:
var shouldStopLoop = false
val handler = object : Handler()
val runnable = object: Runnable // The error occurs here
{
override fun run() {
getSubsData()
if(!shouldStopLoop)
{
handler.postDelayed(this, 5000)
}
}
}
handler.post(runnable)
The Expecting a class body error occurs while I am trying to create the val runnable
.