Hello, I have a screen with fields for typing and a specific field where I will use the external barcode reader. The problem is that the scanner turns off the virtual keyboard. Any ideas on how to leave both assets?
Hello, I have a screen with fields for typing and a specific field where I will use the external barcode reader. The problem is that the scanner turns off the virtual keyboard. Any ideas on how to leave both assets?
You can force the display of Soft Keyboard
to the code entry field, regardless of whether the EditText
has focus, using InputMethodManager
in this way:
EditText yourEditText = (EditText) findViewById(R.id.idDoEditText);
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT);
And to hide programmatically:
InputMethodManager imm = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0);
Source: SO EN question