Objective
Series article:[Portal]
51, look forward to the two-day holiday. It's my birthday, happy.
"Spit Groove"
School is disgusting, half a month ago let me get him a thing, MD, the subject does not add people. Then came to beg, said the money (money, we do not need; I guess not much). Now, again, I faint. Direct words, add me to do, time problem, there may be only semi-finished. Do not Add.
Body
Above, we talked about QR code generation decoding
This time we will use Android to sweep, to achieve the Android scan QR code .
Download Sweep sweep
Package Structure-Introduction
#com. Zxing.xx this is provided by the Zxing Library
#BarCodeActivity
Actual combat
A button, a display of the results of the interface
Packagesedion.jeffli.activity;ImportSEDION.JEFFLI.ITP.R;Importcom.zxing.activity.CaptureActivity;Importandroid.app.Activity;Importandroid.content.Intent;ImportAndroid.os.Bundle;ImportAndroid.view.View;ImportAndroid.view.View.OnClickListener;ImportAndroid.widget.Button;ImportAndroid.widget.TextView;ImportAndroid.widget.Toast; Public classBarcodeactivityextendsActivity {PrivateTextView Resulttextview;//returns the display result (not available later) PrivateButton Scanbarcodebutton; @Override Public voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.barcode); Resulttextview= (TextView) This. Findviewbyid (R.id.tv_scan_result); Scanbarcodebutton= (Button) This. Findviewbyid (R.id.btn_scan_barcode); Scanbarcodebutton.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View v) {//Open the Scan interfaceIntent opencameraintent =NewIntent (barcodeactivity. This, Captureactivity.class); Startactivityforresult (Opencameraintent,0); } }); } @Overrideprotected voidOnactivityresult (intRequestcode,intResultCode, Intent data) { Super. Onactivityresult (Requestcode, ResultCode, data); //determine the processing result and show if(ResultCode = =RESULT_OK) {Bundle Bundle=Data.getextras (); String Scanresult= bundle.getstring ("Result"); //Toast.maketext (This, "result", Toast.length_long). Show ();Resulttextview.settext (Scanresult); } }}
#New Intent (Barcodeactivity.this,captureactivity.class);
Open Scan Interface , captureactivity (this is the activity of scanning)
#ResultCode = = Result_ok
The result is displayed successfully if the decision is successful.
You will see:
The following is the scanned interface:
Captureactivity (provided by Zxing Library, Nice)
View Code
You will see:
Summarize
Android QR code scan
Resource sharing:
Link: http://pan.baidu.com/share/link?shareid=4287950048&uk=3307409781 Password: 3UR2
Thanks and resource sharing
The road came to step by step, I hope you and I together.
Thanks to the reader! I really like the support you gave me. I will respect every word you say, as you respect my article.
Knowledge Source: https://github.com/zxing/zxing/wiki/Getting-Started-Developing