Reputation: 49
I want to give 2 options in My Code for Zxing Bar scanning.
Options:
After selecting first option only Bar-Code should get scan by ZXing Library and same for option two.
Please help me with the code if any flag is there in Zxing to enable and disable.
Upvotes: 2
Views: 3562
Reputation: 1615
I have tested its working for me
For QR code scan use
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
integrator.setPrompt("Scan a Qr code");
integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(false);
integrator.setBarcodeImageEnabled(true);
integrator.initiateScan();
and for bar code use
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
integrator.setPrompt("Scan a barcode");
integrator.setCameraId(0); // Use a specific camera of the device
integrator.setBeepEnabled(false);
integrator.setBarcodeImageEnabled(true);
integrator.initiateScan();
Upvotes: 1
Reputation: 621
For scanning QR Code:
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
For scanning bar code:
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
Upvotes: 2