Set focus on inputfield but hide keyboard in Android

Set focus on inputfield but hide keyboard in Android

  

Hi, 

I want to set focus on an inputfield, so when I scan a barcode the inputfield will be filled with the code. 

When I do that the keyboard is shown. How can I prevent this?


Rosanne


Hi Rosanne,

You can find a solution to your problem here:

https://stackoverflow.com/a/22517664

It looks like if you use blur() on the focus of your input, that should do that trick.

Let me know if you have any issues,

Justin

Hi Justin, 

Thank you for your input.

unfortunately, that doesn't work. When I scan, no value will be inserted in the input, because of the blur.

I attached an example.


Rosanne

Hi Rosanne,

What kind of device are you using? You don't have a scanner plugin on your test.oml.

When your device has an integrated scanner which acts just like a physical keyboard, you can check out this page: https://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard

If you have a scanner plugin, assign the output of the scanner into the variable assigned to the textfield instead of assigning it to the textfield itself.

kind regards,

Remco Dekkinga