Android zxing realizes the scanning and generation of QR code
Zxing:
Zxing is an open source, multi format 1D / 2D barcode image processing library implemented in Java. It contains ports to contact other languages. It can use the built-in camera of the mobile phone to scan and decode the barcode.
github:
https://github.com/zxing/zxing
First, when writing the project, we need to import a moduel, mainly the main function code extracted from zxing. Its address is:
http://pan.baidu.com/s/1sk9pGmT
Scan QR code:
Click the page of scanning QR Code:
startActivityForResult(new Intent(MainActivity.this,CaptureActivity.class),0);
Override onactivityresult() method:
Here: result is passed from captureactivity.
A represents the data information obtained from the QR code.
Generate QR Code:
A tool class for generating QR code is provided in module: encodengutils
It includes two methods: createqrcode () and addlogo ()
Returned type: bitmap
Passed in parameters: createqrcode (string content, int widthpix, int highpix, bitmap logobm)
Content: content generated by QR code
Widthpix: width
Highpix: height
Logobm: the log of QR code is passed to null if it is unnecessary
addlogo(Bitmap src,Bitmap logo)
Add logo on QR code
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. At the same time, I also hope to support a lot of programming tips!