Turn on the phone camera scan QR code or barcode all operation

Source: Internet
Author: User

(1) Download the QR Code library source code

Link: http://pan.baidu.com/s/1pKQyw2n Password: R5BV

When the download is complete, open the folder where you can see the libzxing, and add it to Android Studio, with the following: File------New-----"Import moudle

(2) button click event for scanner

Background code:

Public void Scanner (view view) {
Startactivityforresult (New Intent (Scanactivity.this,
Captureactivity.class), 0);
}


@Override
protected void Onactivityresult (int requestcode, int resultcode, Intent data) {
Super.onactivityresult (Requestcode, ResultCode, data);
if (ResultCode = = RESULT_OK) {
Bundle bundle = Data.getextras ();
String result= bundle.getstring ("result");
Etcan.settext (result);

}
}

(3) If continuous scanning is required
Background code:
Link: Http://pan.baidu.com/s/1sle7v4L Password: o85e

Turn on the phone camera scan QR code or barcode all operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.