Project ITP (ii) QR code pick up your phone and pack it up and sweep the "Daily Beats"

Source: Internet
Author: User


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

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.