Preface
Series of articles:[Portal]
May 1, two days of vacation. My birthday, happy.
[Tucao]
The school is really disgusting. I asked him to give him something half a month ago. md is not a subject. Later I asked for money (money is not needed; I guess not much ). Now again, I'm dizzy. Simply put, add me to do it. Time problems may be half-finished products. Do not add or do not.
Body
As mentioned aboveQR code generation and Decoding
This time we will use android to scan the QR code.
Download Scan
Package Structure-Introduction
# Com. zxing. xx this is provided by the zxing Library
# BarCodeActivity
Practice
One button, one interface for Displaying results
Package sedion. jeffli. activity; import sedion. jeffli. in the left-side navigation pane. r; import com. zxing. activity. captureActivity; import android. app. activity; import android. content. intent; import android. OS. bundle; import android. view. view; import android. view. view. onClickListener; import android. widget. button; import android. widget. textView; import android. widget. toast; public class BarCodeActivity extends Activity {private TextView resultTextView; // return the displayed result (useless in the future) private Button scanBarCodeButton; @ Override public void onCreate (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 (new OnClickListener () {@ Override public void onClick (View v) {// open the scan interface Intent openCameraIntent = new Intent (BarCodeActivity. this, CaptureActivity. class); startActivityForResult (openCameraIntent, 0) ;}}) ;}@ Override protected void onActivityResult (int requestCode, int resultCode, Intent data) {super. onActivityResult (requestCode, resultCode, data); // judge the processing result and display 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 the scan page-> CaptureActivity (this is the activity for scanning)
# ResultCode = RESULT_ OK
The result is displayed successfully.
You will see:
The scan page is as follows:
CaptureActivity (provided by the zxing library, nice)
View Code
You will see:
Summary
Android QR code scan
Resource Sharing:
Link: http://pan.baidu.com/share/link? Required id = 4287950048 & uk = 3307409781 password: 3ur2
Thanks and Resource Sharing
One step on the road, I hope everyone will join me.
Thank you! I like your support. I will respect every sentence you say, just as you respect my article.
Knowledge Source: https://github.com/zxing/zxing/wiki/Getting-Started-Developing