Can I programmatically disable/enable the physical keyboard?

How do I programmatically disable/enable the physical keyboard in Android?

  • I have an application that I'm developing that uses a USB HID device connected to a Motorola Xoom for some input. However, the majority of the time I still want to use the on-screen keyboard. Is there a way to disable/enable the use of hardware keyboard in Android 3.0+? I'd like the application to behave like it would, had there not been a keyboard connected.

  • Answer:

    well one solution you can think of is .. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return true; } @Override public boolean onKeyLongPress(int keyCode, KeyEvent event) { return true; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { return true; } this will avoid any actions during keyboard key press. but there is no way you can disable android keyboard since it will use some native methods.

Fredrik Hedberg at Stack Overflow Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.