journeyapps / zxing-android-embedded

Barcode scanner library for Android, based on the ZXing decoder
https://journeyapps.com/
Apache License 2.0
5.73k stars 1.27k forks source link

How to add UPC E & UPC A barcode filter in DecoratedBarcodeView? #521

Open mahendran92 opened 4 years ago

mahendran92 commented 4 years ago

Is this the right way? But the below code isn't working.

Collection formats = Arrays.asList(BarcodeFormat.UPC_A); barcodeViewNew.getBarcodeView().setDecoderFactory(new DefaultDecoderFactory(formats));

Thanks

challgren commented 4 years ago

I'm having the same issue with 9319110de8927fb4771b928eaf795e43999d8529.

challgren commented 4 years ago

My guess is the following lines are the culprits because calling decode(BinaryBitmap) cause the hints to be set to null.

https://github.com/journeyapps/zxing-android-embedded/blob/master/zxing-android-embedded/src/com/journeyapps/barcodescanner/Decoder.java#L77

If you use the default MultiFormatReader() the setting of formats works correctly.