On a Samsung Tablet, we have the following keyboard:
When a clic occurred on the right bottom arrows, in the view pager, fragment is changed. I want to intercept this event or remove the arrows from the keyboard. Is it possible ?
I tried to intercept keyevent with onKeyUp and onKeyDown methods, but it's not working:
if (event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT || event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT) {
return true;
}
My problem is the same as here
Arrow keys - Using the arrow keys on the keyboard, move the cursor up, down, left, or right in the document. Ctrl and Arrow keys - Holding down Ctrl while pressing the left or right arrow keys moves the cursor one word at a time.
On a Windows computer, to toggle scroll lock on and off, press the Scroll Lock key. On most keyboards, it's located in the control keys section of the keyboard, above the arrow keys or right of the function keys. On a Mac computer, to toggle scroll lock on and off, press F14 or Shift + F14 combination.
Use Alt + Down Arrow keys (Windows and Linux) or Option + Down Arrow keys (Mac) to open drop-down lists that do not have an Apply or Go button, and then use the Down Arrow, Up Arrow and Enter keys to select an item in the drop-down.
Try to use dispatchKeyEvent(KeyEvent event)
:
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Log.i("key pressed ", String.valueOf(event.getKeyCode()));
if(event.getKeyCode() == KeyEvent.KEY_A /*select required keycode*/ ){
// perform task
}
return super.dispatchKeyEvent(event);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With