'Android TV Emulator KEYCODE_DPAD_CENTER event not dispatched
When using the Android TV (1080p) 29API virtual device I've found that the KEYCODE_DPAD_CENTER KeyEvent is never fired. It also doesn't cause a button click event to fire either.
override fun dispatchKeyEvent(event: KeyEvent?): Boolean {
if (event != null) {
when (event.keyCode) {
// This first match is never hit
KeyEvent.KEYCODE_DPAD_CENTER -> Log.d("DPAD", "Center")
// The rest of these all work fine
KeyEvent.KEYCODE_DPAD_UP -> Log.d("DPAD", "UP")
KeyEvent.KEYCODE_DPAD_DOWN -> Log.d("DPAD", "DOWN")
KeyEvent.KEYCODE_DPAD_RIGHT -> Log.d("DPAD", "RIGHT")
KeyEvent.KEYCODE_DPAD_LEFT -> Log.d("DPAD", "LEFT")
}
}
return super.dispatchKeyEvent(event)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
