I'm using ViewPager for swiping between my Fragments. Is it possible to integrate a QR scanner (zxing or any other) inside of a Fragment so that I can swipe from scanners View to another Fragment and vice versa?
As far as I can tell, the majority of qr scanners require me to use an extended Activity class and to start it for result, handling it in onActivityResult, which is not an option to me
A QR code works similarly to barcodes at the supermarket. Each QR code consists black squares and dots which represent different pieces of information. When scanned, the unique pattern on the barcode translates into human-readable data. This transaction happens in seconds.
The QR code scanner begins at the bottom right of the QR code. It then moves up two data modules at a time until it hits the first position marker. Then it moves two data modules to the left and goes down.
The embedded authentication data contains a message authentication code or the cryptographic signature of the encoded data. It is being embedded into the QR code by taking advantages of the barcode redundancy. The printed stego QR code is first captured by a mobile phone camera or a barcode scanner.
The barcodefragmentlib is the one you are looking for. And its wiki shows you how to integrate it (although I used a different way before the wiki comes out).
However after fully integrated it and solve all the issues for our commercial app, I feel like put a QR scanner inside a fragment and switch using ViewPager is not a good idea. Some of the known issues with this idea and the mentioned library to me are:
Although these issues mentioned above can be solved with certain effort, it is really a trade off.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With