Reputation: 80
I'm building a demo barcode scanning application and have gotten on pretty well.
I am using the ContinuousCaptureActivity
example so I can have a scan window, scan options and the resultant barcode results all on 1 activity.
I have it working really well but I would like to be able to change the barcode types looked for dynamically.
I know how to do this using the Intent
system way of doing it but this I believe is only used when you call up a built in Zxing barcode layout, however in this case I am doing everything on the same custom window so I need to be able to do things in code when I set an Android switch to "ON"
I read that the CaptureManager
object can work in this way but I've spent days on this, but I wasn't able to achieve my goal... Does anyone have any suggestions?
Upvotes: 2
Views: 1621
Reputation: 80
OK, so I worked it out finally. I noticed that you can initialize the BarcodeView with an intent, so I tried this:
IntentIntegrator integrator = new IntentIntegrator(this); integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
intent = integrator.createScanIntent();
barcodeView.initializeFromIntent(intent);
This will start up the barcode scanner with the desired barcode filter.
Upvotes: 2