How to initialize a Thread in Kotlin?

后端 未结 9 2246
青春惊慌失措
青春惊慌失措 2021-02-06 21:14

In Java it works by accepting an object which implements runnable :

Thread myThread = new Thread(new myRunnable())

where myRunnable

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 22:08

    I did the following and it appears to be working as expected.

    Thread(Runnable {
                //some method here
            }).start()
    

提交回复
热议问题