Back to project page barcodescanner.
The source code is released under:
Apache License
If you think the Android project barcodescanner listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package me.dm7.barcodescanner.zbar.sample; /*from www.jav a2 s .c o m*/ import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.widget.Toast; import me.dm7.barcodescanner.zbar.Result; import me.dm7.barcodescanner.zbar.ZBarScannerView; public class SimpleScannerActivity extends ActionBarActivity implements ZBarScannerView.ResultHandler { private ZBarScannerView mScannerView; @Override public void onCreate(Bundle state) { super.onCreate(state); mScannerView = new ZBarScannerView(this); setContentView(mScannerView); } @Override public void onResume() { super.onResume(); mScannerView.setResultHandler(this); mScannerView.startCamera(); } @Override public void onPause() { super.onPause(); mScannerView.stopCamera(); } @Override public void handleResult(Result rawResult) { Toast.makeText(this, "Contents = " + rawResult.getContents() + ", Format = " + rawResult.getBarcodeFormat().getName(), Toast.LENGTH_SHORT).show(); mScannerView.startCamera(); } }