Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keycode for Android minimize soft keyboard button

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.

like image 676
user1148417 Avatar asked Jan 13 '12 20:01

user1148417


People also ask

How do I force an Android keyboard to pop up?

Simple. Download the Gboard - the Google Keyboard – Apps on Google Play - and then go to the settings section on your Android device >> General Management >> Language and Input >> Default Keyboard (Select Gboard).

How to Handle keyboard in Android studio?

To handle an individual key press, implement onKeyDown() or onKeyUp() as appropriate. Usually, you should use onKeyUp() if you want to be sure that you receive only one event. If the user presses and holds the button, then onKeyDown() is called multiple times.


1 Answers

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);
}
like image 62
Teovald Avatar answered Oct 14 '22 05:10

Teovald