Wanting to know how to get the Android soft keyboard to open up without having to enter something into a field and how to get the key presses from the open keyboard.
Asked
Active
Viewed 124 times
1 Answers
1
Kai -
To show the keyboard you can use the below code:
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
(as provided here https://stackoverflow.com/a/11155404)
To get the key presses without an input field focused, you can use the onKeyDown event handler like this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// Capture keyCodes here
return super.onKeyDown(keyCode, event);
}

Community
- 1
- 1

TheGrandPackard
- 611
- 4
- 11