How can I start dynamic rendering on canvas and stop or change the rendering when the onTouchEvent event occurs?
There is a separate View class that implements rendering on canvas and listening for onTouchEvent events. How can they be run in different coroutines or threads, but so that events can stop or change rendering?
class CustomView(
context: Context,
attributesSet: AttributeSet?
) : View(context, attributesSet) {
...
private val pointer=...
var x = false
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
while(true){...