Is it possible to simultaneously work with both a physical keyboard and a soft keyboard?

My application should have two input sources at the same time: a barcode scanner and a soft keyboard. When I connect the scanner to the blue tooth, it is treated like a physical keyboard. So, when this device is connected, the soft keyboard is not displayed (soft keyboard is deactivated).

Can I activate both a physical keyboard and a soft keyboard at the same time? If not, what is the best approach to solving the problem? Do I have to execute a custom view that pauses keypress events? Is there a keyboard app on the market that does this?

How do I programmatically turn the physical keyboard on and off? This is the “Use physical keyboard” toggle button (here I found a screenshot of this option:

enter image description here

+5
source share
1 answer

It is not possible to simultaneously activate both a physical keyboard and a soft keyboard. It is used by the 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() {

Therefore, if you do not use your own IME, in which you can override onEvaluateInputViewShown, it is impossible to activate both the physical and soft keyboards at the same time.

, , , hardKeyboard. ,

+1

All Articles