3

Does anybody know the keycode for dismissing the soft keyboard in Android?

I have gone through the doc of KeyEvent class

http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MEDIA_REWIND

but could not find an appropriate one.

By the keycode to dismiss the soft keyboard I mean the one on the soft keyboard that is able to close the keyboard panel rather than the "back" key on the bottom of the device.

Many Thanks!!

Bohr
  • 31
  • 2
  • 1
    There's no such thing. To close the keyboard, c.f. http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard – Julian Fondren Mar 06 '13 at 21:15
  • The soft key you describe is implementation specific, not all Android keyboards have it. – Barend Mar 06 '13 at 21:17

4 Answers4

1

this answer may works for you...Try this

set android:codes="-3" to a key for dismissing 
Madhuri
  • 368
  • 1
  • 10
0

maybe this is what you mean: im not sure

android:imeOptions="actionDone"

this will turn the return key into the done key to dismiss the keyboard

JRowan
  • 6,520
  • 6
  • 34
  • 57
0

Are you asking how to close it in like an onClick method?

I think what you may want is this:

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(text.getWindowToken(), 0);
TronicZomB
  • 8,299
  • 7
  • 32
  • 47
  • No. There is a key to dismiss keyboard on the left bottom corner of softkeyboard. He wants the code of that key. Even i am trying the same now. I guess only back, backspace are detectable – Ajith Memana Apr 24 '13 at 09:59
0
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
Dekra
  • 514
  • 5
  • 15