Skip to content
Advertisement

Convert indefinitely running Runnable from java to kotlin

I have some code like this in java that monitors a certain file:

JavaScript

This is my kotlin code:

JavaScript

I dont understand what Runnable I should pass into mHandler.postDelayed. What is the right solution? Another interesting thing is that the kotlin to java convertor freezes when I feed this code.

Advertisement

Answer

Lambda-expressions do not have this, but object expressions (anonymous classes) do.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement