Using a two-dimensional code scanning and Zxing

   这段时间我做的一个app需要用到二维码扫描,但是找遍了我们的51CTO都没有找到合适的文章,我想把我自己利用zxing做二维码扫描的方法提供出来供大家参考。

What is the Z- ?
Android platform has done two-dimensional code related modules are certainly familiar with the open source ZXing project, Z
is an open source Java library for parsing a variety of formats 1D / 2D bar codes. The goal is capable of decoding the QR code, Data Matrix, UPC 1D bar codes. It provides clients in a variety of platforms including: .NET and C #, J2ME, J2SE and Android. Its GitHub address is: https://github.com/zxing/zxing. The current latest version is 3.4.0, this time I used 3.3.2 .
The Z-project * which a lot of code to achieve a lot of functions, our application scanning module can only be stripped of them, that is a little more generation two-dimensional code; then we will work together to streamline the ZXing project, eventually forming a small Demo case, of course, the rivers and lakes have been several versions of ZXing N streamline the project, what change the horizontal screen vertical screen, rendering scanning interface open flash and so on, and many of which are based on the new features do ZXing2.3.0 streamlined, there are a lot of follow-up version of the update, including auto focus, Camera management, bug fix, and so on; I use a ZXing3.1.0 version here it should be noted this is my Demo version is definitely the top corners of the country has not yet appeared, can be considered a little bit of the innovation, and that is to remove the ZXing project annoying ViewFinderView drawing, scanning interface using XML layouts, add scanned animation, accurate calculation of the scan area.
Open the file ZXing project folder ( https://github.com/zxing/zxing), you can see the following directory :

Download Zxing is a complete package, but this package is still too big, I just chose to put part of my program.
Here is my program, which must be downloaded zxing package, marked out the figure by the red part.

Guess you like

Origin blog.51cto.com/fengyp/2440040