Wykryj telewizor zdalnych klawiszy Andoid Studio
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d("debug", "we are here");
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_RIGHT:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_ESCAPE:
Log.d("OnKey", "key pressed!");
Toast.makeText(MainActivity.this, "key pressed!", Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
SamuraiR4cc00n