I'm trying to debug an issue where if I pause and ...
# android
d
I'm trying to debug an issue where if I pause and resume my app multiple times (by hitting the activity overview button and then clicking on my activity) eventually my touch handler will stop getting any events. This never happens when I'm running with a debugger.
The only weird thing I do that I can think of is launch coroutines from within the handler like so
Copy code
touchView.setOnTouchListener { view, event ->
            Timber.i("Touch event %s", event)
            when (event.action) {
                MotionEvent.ACTION_MOVE -> {
                    last?.let { currentLast ->
                        val now = ScreenCoordinate.fromEvent(event)
                        val delta = now - currentLast
                        last = now
                        launch {
                            _events.emit(TouchEvent.Move(delta))
                        }
                    }
                }

                MotionEvent.ACTION_DOWN -> {
                    last = ScreenCoordinate.fromEvent(event)
                    // required for accessibility
                    view.performClick()
                }

                MotionEvent.ACTION_UP ->
                    last = null
            }

            // return value is whether the event was handled
            true
        }
The touch handler is attached in an activity onCreate