1. First Add this in yr Gradle
2.Secondly Add this in Activity
Use This Method
compile 'me.dm7.barcodescanner:zxing:1.9.8'
compile 'com.edwardvanraak:MaterialBarcodeScanner:0.0.6-ALPHA'
2.Secondly Add this in Activity
public static final String BARCODE_KEY = "BARCODE"; private Barcode barcodeResult;
Use This Method
private void startScan() {
final MaterialBarcodeScanner materialBarcodeScanner = new MaterialBarcodeScannerBuilder() .withActivity(this) .withEnableAutoFocus(true) .withBleepEnabled(true) .withBackfacingCamera() .withCenterTracker() .withText("Scanning...") .withResultListener(new MaterialBarcodeScanner.OnResultListener() { @Override public void onResult(Barcode barcode) { barcodeResult = barcode;
String Get_code_Text = barcode.rawValue.toString(); } }) .build(); materialBarcodeScanner.startScan(); }