epool
05/04/2016, 5:02 PMRunnable
and Kotlin () -> Unit
? I mean I have in kotlin the next Runnable code val mResetTapsCounterRunnable = Runnable { mTapsCounter = 0 }
and in an on click event I have a handler like this
mHandler.removeCallbacks(mResetTapsCounterRunnable)
mHandler.postDelayed(mResetTapsCounterRunnable, mDelayMillisToResetTapsCounter.toLong())
With this everything works as I hope(the runnable is removed and readded to the handler).
But if I change the runnable declaration to a lambda expression like this val mResetTapsCounterRunnable = { mTapsCounter = 0 }
kotlin compiles well but it is not been removed from the hadler with the removeCallbacks()
method and the mResetTapsCounterRunnable
is invoked.