I want to identify which key is pressed from the keyboard while type text into EditText
box. I am using this code, but it is not working.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
if (keyCode == KeyEvent.KEYCODE_SPACE) {
Toast.makeText(MainActivity.this, "White space is clicked", Toast.LENGTH_LONG).show();
return true;
}
return super.onKeyDown(keyCode, event);
}
where i am getting wrong?