简体   繁体   中英

Trying to get data from barcode device

I have a barcode device that can be connected to a computer or to an android device through USB port. It scans the barcode and show the result wherever it finds a cursor, it can be an editbox, notepad, browser or whatever. What I want to do is to get data in a variable as soon it scans the barcode without showing it on the edittext.

Your scanner is functionally equivalent to a keyboard, so you can't scan the data directly into a variable.

However, as @MH. suggested, you can watch a text input field and grab the data once it's entered. You might be able to programmaticly set the focus on the hidden field when the user clicks a button. If that doesn't work you might be able to style the input so the user can't see the scanned data (eg make the text color the same as the background color)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM