'slow reading barcode scanner (hid mode)

I am currently implementing an application for scanning barcode codes. The scan is handled by and external barcode reader, which is connected via USB with HID protocol (if an EditText is focused, the code is printed on the EditText ,like a keyboard). The problem is that the reading of the data is very slow.

I am testing it on my laptop, so the barcode reader is connected from USB port. If I focus an EditText on a random laptop program (browser, notes, microsoft word, ...), the scan is basically instant. If i use the app from the emulator, it take nearly 2/3 sec to print all the data, and sometime it also print wrong data (instead on the pc never fail).

This is the code

200002300168’200002400252’200002700224’200002800280’200101700140’200044500140’200045000140’200045100077’200200100014’200200200035’200200300025’200200400043’200200500053’200200600033’200200700116’200200800033’200200900055’200201000051’200201100011’200201200169’200201300170’200201400531’200201500641’200201600010’200201700171’

Any idea what the problem might be?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source