Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have both Physical Keyboard and Soft Keyboard active at the same time?

My Application needs to have two sources of input active at the same time: A bar-code scanner and the soft keyboard. When I pair a blue-tooth scanner, it is being treated as a physical keyboard. So, when this device is connected, the soft keyboard is not being displayed (soft keyboard is deactivated).

Is it possible to have both Physical Keyboard and Soft Keyboard active at the same time? If not, what is the best approach towards solving the problem? Do I have to implement a custom View that sinks key press events? Is there any keyboard App on the Market that does this?

How do I, programatically, turn the Physical Keyboard On and Off? This is the toggle button 'Use Physical Keyboard' setting (I found the screenshot of this setting here:

enter image description here

like image 285
Anhsirk Reddy Avatar asked Nov 14 '22 17:11

Anhsirk Reddy


1 Answers

It is not possible to have both Physical Keyboard and Soft keyboard active at the same time. It is enforced by InputMethodService function onEvaluateInputViewShown. you can check the documentation here.

/**
 * Override this to control when the soft input area should be shown to
 * the user.  The default implementation only shows the input view when
 * there is no hard keyboard or the keyboard is hidden.  If you change what
 * this returns, you will need to call {@link #updateInputViewShown()}
 * yourself whenever the returned value may have changed to have it
 * re-evaluated and applied.
 */
public boolean onEvaluateInputViewShown() {

So unless you are implementing your own IME wherein you can overide onEvaluateInputViewShown it is not possible to have both Physical and softkeyboard to be active at the same time.

Regarding your last question i am not sure but I think there is no way to programmatically hide the hardKeyboard. Though it doesn't have the solution you should check this question

like image 127
dinesh Avatar answered Dec 29 '22 22:12

dinesh