My program works great if I use the following code however I know the calling GlobalScope is bad but I can’t make anything else work.
Please help me fix the following code so that it’s written cleanly with co-routines I must use a coroutine to do the work.
Thanks,
calmchess
//periodic polling
val mainHandler = Handler(Looper.getMainLooper())
var oneTime0=true
mainHandler.post(object : Runnable {
override fun run() {
mainHandler.postDelayed(this, 6000)
for (i3 in 0..20) {
GlobalScope.launch{pollImageSlotMethod0(context0, act0)}
}
}
})