I am developing an application communicating with a server and at one point need to force open a keyboard and send the pressed characters on the keyboard to the server.

Everything worked just fine until my phone upgraded to Android Lollipop and now suddenly the keyboard opens, but does not react to any interactions. On the other hand all the buttons under the keyboard layout react when i try to type the keyboard letters. Which means that the keyboard layout is letting everything through.

I use a button to open the keyboard:

public void b_view_keyboard(View view) {

  imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

For reading the pressed buttons I use a regular onKeyDown(int keyCode, KeyEvent event), which always worked great until the Android Lollipop update.

I found a different post "Android Lollipop soft keyboard doesn't accept keypresses with GL surface" where the person has got exactly the same problem (also not answered as of 26th of March 2015).

I thank everyone who can help me with this annoying issue,

Thank you, Edward.

I just figured out that it only occurs in landscape orientation. For my purpose I am forcing a landscape orientation and then the fullscreen keyboard opens and messes things up. How can I change the keyboard input type for not having the fullscreen option in code while forcing a keyboard to open? Remember that there is not EditText or similar.


onKeyDown never worked. That function is for hardware keys only- volume, physical keyboards, etc. The only way that might have worked is if you tricked a keyboard into thinking you were a null input connection and it tried to enter the stupidest possible mode- and I'm not even sure it would work then, and if it did it would only be with a subset of keyboards. The only way to reliably get input from a soft keyboard is to have your view return an InputConnection from onCreateInputConnection and to implement the keypress and commit text functions there. Please note that the VAST majority of android keyboards don't implement key-like functionality at all, they do everything via commitText and occasionally composing text, as they're far richer APIs.

  • The onKeyDown methode is not the topic of the problem. Please refrain from unhelpful comments like this. Thank you. – Edward12345 Mar 26 '15 at 11:32
  • It is the problem. 100% the problem. Please stop thinking you know better than someone who spent 4 years writing Android keyboards. – Gabe Sechan Mar 26 '15 at 17:03
  • Hello Gabe Sechan. I appologise. I did not try to offend a person with a lot more experience than me. I only got my information of solving my problems from different topics when it comes to listening to soft keyboard presses. – Edward12345 Apr 1 '15 at 12:09
  • Anyway. Please look into this issue. Create an App with just one Button. When the Button is pressed force open the keyboard. Thats it, no listeners or onKeyDown events included. When running the app and forcing the keyboard to appear, in portrait mode all the buttons react. After flipping your phone to landscape mode, only the top layer of the keys react. This only happend since Lollipop was suddenly was installed. It is also possible to simulate this in the emulator. How can I solve this? Thank you. – Edward12345 Apr 1 '15 at 12:14

Your Answer

