Need help in converting this into a coroutine :sli...
# android
z
Need help in converting this into a coroutine 🙂
Copy code
nextButton.setOnLongClickListener {
            val handler = Handler(Looper.myLooper()!!)
            val runnable: Runnable = object : Runnable {
                override fun run() {
                    handler.removeCallbacks(this)
                    if (nextButton.isPressed) {
                        println("Do Something!")
                        handler.postDelayed(this, 500)
                    }
                }
            }
            handler.postDelayed(runnable, 0)
            true
}