Switch from physical to software keyboard
Asked Answered
S

3

2

Switch from physical to software keyboard. Hi all, I'm developing an application that will run on a tablet with Android 3.2. I attached a physical keyboard to tablet then the software keyboard disappear. Now I need to use the software keyboard in some activities, but I don't figure out how I can do that.

I tried different ways:

Android: show soft keyboard automatically when focus is on an EditText

http://dev.bostone.us/2009/11/04/android-show-and-hide-soft-keyboard-programmaticaly/#awp::2009/11/04/android-show-and-hide-soft-keyboard-programmaticaly/

http://plainoldstan.blogspot.com/2010/09/android-set-focus-and-show-soft.html

All these don't work if the physical keyboard is connected.

Someone know how can I achieve this goal?

Thanks

Stelu answered 11/2, 2012 at 23:2 Comment(0)
A
4

Under setting ther will be "Language & Input" >> Keyboard Setting >> "Input method selector" >> "Always show"

after you plug in the keyboard just put on the Keyboard ICON "on the bottom right of the screen" the select "USE PHYSICAL KEYBOARD" to off

Then the Soft keyboard (on screen) will appear normally until you unplug the keyboard.

In my case i use the barcode scanner instead of keyboard so I do need some softkeyboard however I use the USB hub and connect both barcode scanner and numeric keyboard.

hope this will help you.

Arraignment answered 5/3, 2012 at 6:20 Comment(0)
G
2

Yes, when a keyboard is connected to the device, by default the soft keyboard is disabled. To enable it, we need to turn OFF hardware keyboard via:

Settings > Language & Input > Select Input Method

The option name may differ from device to device. We will be able to use the scanner along with the soft keyboard even though we turn it OFF.

And NO, there is no way currently to programmatically accomplish this. The most we can do is detect when a keyboard/scanner is connected and redirect the user to the Input Method selection window, by overriding the onConfigurationChanged method in your Application class:

@Override
public void onConfigurationChanged(Configuration newConfig) {
  super.onConfigurationChanged(newConfig);
  if(newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {

    ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
                                  .showInputMethodPicker();
    Toast.makeText(this, "Barcode Scanner detected. Please turn OFF Hardware/Physical keyboard to enable softkeyboard to function.", Toast.LENGTH_LONG).show();
  }
}
Grovergroves answered 18/6, 2014 at 14:13 Comment(0)
M
1

Actually we can use physical keyboard and soft keyboard simultaneously, what u have to do is that after connecting your physical keyboard, focus on any edittext, then you can see a keyboard icon on bottom right of your screen, click on it , it'll show all all available soft i/p options plus a Switch titled 'Show Virtual keyboard - keep it on screen while physical keyboard is active' - just check this option

enter image description here

Mikelmikell answered 24/3, 2019 at 8:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.