Android with external barcode reader

Asked

Viewed 634 times

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 disables the virtual keyboard. Any idea how to leave the two active?

  • you can’t put a button that switches between the two?

1 answer

2

You can force the display of Soft Keyboard for the entry field of the code, regardless of whether the EditText has focus, using the InputMethodManager in that 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: Question from the OS EN

  • 1

    It means our SOPT is not official? :)

  • Eitcha @Piovezan, it’s beta :P I’ll change that.

  • Ahah, boring this Piovezan. :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.