Android with external barcode reader

0

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?

    
asked by anonymous 28.05.2014 / 19:41

1 answer

2

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

    
28.05.2014 / 19:51