简体   繁体   English

试图从条形码设备获取数据

[英]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. 我有一个条码设备,可以通过USB端口连接到计算机或Android设备。 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. 我想要做的是在扫描条形码后立即在变量中获取数据而不在edittext上显示它。

Your scanner is functionally equivalent to a keyboard, so you can't scan the data directly into a variable. 您的扫描仪在功能上等同于键盘,因此您无法将数据直接扫描到变量中。

However, as @MH. 但是,作为@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) 如果这不起作用,您可以设置输入样式,以便用户无法看到扫描数据(例如,使文本颜色与背景颜色相同)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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