Show soft keyboard even though a hardware keyboard is connected

Is there any way to show software keyboard with USB keyboard connected (in my case RFID reader)?
I tried to force show it using InputManager (with these or similar parameters), but with no luck

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput(InputMethodManager.SHOW_FORCED,0);

Important notice – I know that there is a button in status/system bar to show it, but this button is not visible to user (Kiosk app).

  • How to draw path as I move starting from my current location using Google Maps
  • How to make flatMap execute on background thread
  • android memory management in activity lifecycle
  • How to programmatically create and read WEP/EAP WiFi configurations in Android?
  • How to check whether a particular device supports 4G networks in Android?
  • How can you set the http proxy programatically?
  • Related posts:

    How to set shape's opacity?
    Dynamically adjusting widget's content and layout to the size the user defined through resi...
    StandardCharsets.UTF_8 on lower API lower than 19
    adb: error while loading shared libraries: cannot open shared object file: No such ...
    Toolbar is hidden in nested PreferenceScreen
    AVD cannot be created Ok is disabled
  • Launch android application from a browser link
  • Android - Can't create handler inside thread that has not called Looper.prepare()
  • could not build app Error:Execution failed for task ':app:package “packageName” Debug'. > value (73836) > 0x0000ffff
  • Lollipop notification icon too small
  • Getting reference to nested fragment from FragmentTabHost
  • Set google as search bar in home screen Custom launcher programmatically
  • 4 Solutions collect form web for “Show soft keyboard even though a hardware keyboard is connected”

    You need to override the InputMethodService method onEvaluateInputViewShown() to evaluate to true even when there is a hard keyboard. See onEvaluateInputShown() and the Soft Input View section of InputMethodService. Try creating your own custom InputMethodService class to override this method.

    EDIT: The source for onEvaluateInputShown() should help. The solution should be as simple as creating your own class that extends InputMethodService and overriding this one method, which is only a couple of lines long. Make sure to add your custom service to your manifest as well.

    From Source:

    “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 updateInputViewShown() yourself whenever the returned value may have changed to have it re-evalauted and applied.”

    public boolean onEvaluateInputViewShown() {
         Configuration config = getResources().getConfiguration();
         return config.keyboard == Configuration.KEYBOARD_NOKEYS
                 || config.hardKeyboardHidden == Configuration.KEYBOARDHIDDEN_YES;

    Here are the possible configurations you can check for. Configuration.KEYBOARD_NOKEYS corresponds to no hardware keyboard. This method returns true (soft keyboard should be shown) if there is no hardware keyboard or if the hardware keyboard is hidden. Removing both of these checks and simply returning true should make the software keyboard visible even if a hardware keyboard is attached.

    Try (not tested):

    public boolean onEvaluateInputViewShown() {
         return true;

    Since this return value will not change, you won’t need to call updateInputViewShown() yourself. If you modify this method differently, be sure to remember this detail.

    The soft keyboard can have unpredictable behaviour on different platforms. First in your code, ensure you have an editable input control. Eg, if you have an EditText, you could use:

        .showSoftInput(myEditText, InputMethodManager.SHOW_FORCED);

    However, you can just show and hide it whenever you want using:

    //show keyboard:
    //hide keyboard :

    You could also add any of these events inside OnCreate or some other method of the controls.

    If however for some reason any of the above fails, your best option might be to use an alternative keyboard, e.g. Compass Keyboard,


    You could even build yours:

    See an example of a keyboard implementing the inputmethodservice.KeyboardView

    You might also want to take a look at the GingerBread Keyboard source.

    This worked in my app, interestingly, also an kiosk app.

    This is a bit stripped, I did some checks beforehand, whether IMM is null and such.

    ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInputFromWindow(someInputView.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);

    according to this, I made working solution for Kiosk mode.

    boolean hardwareKeyboardPlugged=false;
    mEditText.setOnFocusChangeListener(this);//in onCreate()
    public void onResume() {
        //protect from barcode scanner overriding keys
        hardwareKeyboardPlugged=(getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO);
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus)
            if (hardwareKeyboardPlugged){
                //protect from barcode scanner overriding keys
                Toast.makeText(this, "USB device detected. Turn OFF hardware keyboard to enable soft keyboard!", Toast.LENGTH_LONG).show();
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.