Button to trigger scanning : stops detecting after a while

75 views
Skip to first unread message

Anton Gildebrand

unread,
Nov 19, 2014, 3:53:27 AM11/19/14
to zx...@googlegroups.com
First of all i gotta thank you guys for an awesome job with the ZXing App. We've utilized it in one of our customer projects and it's really good. Now that's actually the problem we are experiencing, it's too good!

The surface which our customer scans for barcodes using ZXing has multiple barcodes. ZXing is really fast finding barcodes, which makes it a common mistake that the wrong barcode is scanned. So we figured out a solution: Let's add a trigger-button to the scanning process. The user sees the viewfinder and can aim at the barcode, and presses a button whenever they have aimed at the right barcode. Now this is working quite well. However; you have to be quick by finding your barcode because after a while, ZXing will not detect the barcode anymore. The yellow dots will stop to appear.

Why is this?

What we've done, is that we have added a "shoot" boolean to CaptureActivity. When we enter the handleDecode method, we check if "shoot" is false. If so, we exit handleDecode without any further processing.

There's probably a better way to do this, what do you think?

Sean Owen

unread,
Nov 19, 2014, 4:33:34 AM11/19/14
to zx...@googlegroups.com
It doesn't stop looking for a barcode. It sounds like your modifications have broken the focus-scan cycle event loop. Look at how events are passed between the focus callback and the decode callback.

Anton Gildebrand

unread,
Nov 21, 2014, 5:24:57 AM11/21/14
to zx...@googlegroups.com
Hi Sean and thank you for your reply!

The only actual modification I've done is to add an if statement to handleDecode before all the previous code. How do you think I should do this instead?

It does work if Im really quick but if i wait for say 10 seconds then I can't scan the barcode.

Anton Gildebrand

unread,
Nov 26, 2014, 3:38:04 AM11/26/14
to zx...@googlegroups.com
How would be the "right" way to implement a "trigger"-button to start detecting barcodes?
Reply all
Reply to author
Forward
0 new messages