Enable the mobile phone camera to scan the QR code or complete the operations, mobile phone camera Barcode

Source: Internet
Author: User

Enable the mobile phone camera to scan the QR code or complete the operations, mobile phone camera Barcode

(1) download the source code of the QR code library

Link: http://pan.baidu.com/s/1pKQyw2n password: r5bv

After the download is complete, open the libzxing folder and add it to Android Studio. For details, see File ------ New ----- Import Moudle.

 

(2) click the button to change the event to success.

Background code:

Public void Preview (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) continuous scanning
Background code:
Link: http://pan.baidu.com/s/1sle7v4L password: o85e

 

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.