Question

I'm using the soft keyboard for Android 3.2. The problem is I can't find the keyCode for the button on the bottom left that minimizes the keyboard.

I used a switch case for onKeyDown to display the keyCode and it seems to be the only one without a value. I figured it would have the same code as the back button since that is what it replaces but no such luck.

Was it helpful?

Solution

It is just the back button. You can just do this by overriding its behavior, with :

 InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);

and :

@Override
boolean onKeyDown(int keyCode, KeyEvent event) {
//hide the soft keyboard
 super.onKeyDown(keyCode, event);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top