0

I have an Activity where the user can read some barcodes with a barcode scanner (think on it like a hardware keyboard), which sends a string (usually full of numbers) and a CR symbol at the end (an "enter", we could say). When I read this CR symbol, I have to open a dialog and do some stuff on it with the received string.

The questions are:

  • How can I listen the string received form the barcode scanner without writing it on an EditText? I mean, since the barcode scanner is like a hardware keyboard, writing the string on a hidden EditText and then listen for the CR symbol could be a solution, but there has to be a more elegant way...
  • How can I listen to the CR symbol and how could I difference it from the string full of numbers?

I've taken a look at the Handling Keyboard Actions tutorial, but I think it doesn't fit my needs.

Any idea?

moictab
  • 959
  • 6
  • 27

1 Answers1

0

Have you looked at the Zxing library: https://zxingnet.codeplex.com/

This might help as well, you notice some example storing the results in a string for processing: How to read barcodes with the camera on Android?

Community
  • 1
  • 1
ServerMonkey
  • 1,042
  • 3
  • 19
  • 42