see this keyevent and use the following code to determine which key users clicked.
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { // Do Code here } else if(keyCode == KeyEvent.KEYCODE_0) { } else if(keyCode == KeyEvent.KEYCODE_1) { } return super.onKeyDown(keyCode, event); }
source share