Domanda

I have a BarCode scanner CipherLab 1070. It is connected to Android device through OTG-cable. I need to read BarCode with the help of it.

When i'm scanning code with the help of this device it :

  1. Scan numbers
  2. Send number one by one to android, to my application. Application see it as KEY_DOWN event.
  3. After it a) if there is any clickable item in my activity - scanner touch down it (but not touch up) (it looks like you click_down view with your finger and do not release it) b) If any view is already holded (touched down) - it does touch_up (like you released finger from view and click event occurs).

So, if i read 2 bar codes in a row - scanner simulates 1 click at some view. If i read 6 codes - 3 clicks.

It works in most part of application, where some buttons exists. Example - ColorSheep. When i scan bar code - my color is reseted O_O

And 1 more thing. I have 2 fragments. 1 with list View and 1 GridView. Both have implemented adapters and onItemClickListeners. Scanner activates subViews of GridView.

So what happends : i have grid of items, if i scan code - 1-st item is "touched_down". If i scan 2-nd - "touch_down" released and onItemClickListener is called for 1-st item. 4 - touch_down, 4 - touch up and onItemClickListener.

If i click on some specific item in GridView - then this bug occurs with this item.

Example : i click at 5-th item. It is clicked, all is ok. Then i read code 6 times. So 5-th item will be "clicked" 3 times.

About procedure of barCode scanning. My app see sequence of "keyDown" events. After it scanned with the help of some magick start clicking my views. And not only views. If my activity do not has any views, but has menu, scanner "click" my menu.

Thanks for any help.

È stato utile?

Soluzione

The problem is solved now. My BarCode skanner was configured to append some specific "Enter" symbol after the scanned string.

I just changed this prefix and it works fine now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top