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