Android QR code scanning based on barcodescanner
QR code scanning has become a very common basic function of app. Appendix 1 is an open source project for QR code / bar code scanning that I have used. However, the project integration and secondary customization in Appendix 1 are cumbersome and troublesome. Therefore, it can be found that many people have made secondary development based on zxing and contributed these projects to GitHub, among which barcodescaner is such a project, GitHub project address of barcodescaner: https://github.com/dm77/barcodescanner , barcodescanner simplifies the difficulty of zxing integration and secondary customization, facilitates rapid integration and development, and the scanning performance and results are relatively stable. Now an example of two-dimensional code scanning based on barcodescanner is given.
First, introduce a reference to barcodescaner, and add dependencies in build.gradle:
compile 'me.dm7.barcodescanner:core:1.9' compile 'me.dm7.barcodescanner:zxing:1.9'
Second, write layout:
Third, the upper java code:
Don't forget to add camera and flash permissions:
The code running results are shown in the figure below:
Appendix: Android realizes the fast integrated QR code scanning function based on zxing
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.