1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
@Override public boolean onKeyDown(int keyCode, KeyEvent event){
switch(keyCode){
// Exemple des cas des lettres
case KeyEvent.KEYCODE_S :// votre action ;return true;
case KeyEvent.KEYCODE_P : // votre action;return true;
// Exemple des cas des nombres
case KeyEvent.KEYCODE_0 :// votre action;return true;
// Exemple des cas de la touche appel
case KeyEvent.KEYCODE_CALL:// votre action;return true;;return true;}
case KeyEvent.KEYCODE_ENDCALL:// votre action;return true;}
// Le cas de Home
case KeyEvent.KEYCODE_HOME:{// votre action;return true;}
// cas de retour en arriere
case KeyEvent.KEYCODE_BACK:{// votre action;return true;}
// Les touches de directionnement
case KeyEvent.KEYCODE_DPAD_CENTER:// votre action;return true;
case KeyEvent.KEYCODE_DPAD_DOWN:// votre action;return true;
case KeyEvent.KEYCODE_DPAD_RIGHT:// votre action;return true;
case KeyEvent.KEYCODE_DPAD_UP: // votre action;return true;
case KeyEvent.KEYCODE_DPAD_LEFT:// votre action;return true;
} |
Partager