Java Zxing嵌入式条形码阅读器使用(条形码视图)

Java Zxing嵌入式条形码阅读器使用(条形码视图),java,android,zxing,barcode-scanner,pdf417,Java,Android,Zxing,Barcode Scanner,Pdf417,我的问题是,扫描pdf417条形码格式时,有时会根据扫描结果返回UPC_E格式 下面是我的代码片段 private BarcodeView barcodeView; private BarcodeCallback callback = new BarcodeCallback() { @Override public void barcodeResult(BarcodeResult result) { if

我的问题是,扫描pdf417条形码格式时,有时会根据扫描结果返回UPC_E格式

下面是我的代码片段

 private BarcodeView barcodeView;

    private BarcodeCallback callback = new BarcodeCallback() {
            @Override
            public void barcodeResult(BarcodeResult result) {
                if (result.getText() != null) {          
    Toast.makeText(getActivity(), result.getText(), Toast.LENGTH_LONG).show();
                }
            }
            @Override
            public void possibleResultPoints(List<ResultPoint> resultPoints) {
            }
        };

您可以将格式传递给intent integrator进行扫描。比如:

IntentIntegrator integrator = new IntentIntegrator(this); 
integrator.setDesiredBarcodeFormats(IntentIntegrator.PDF_147);
intent = integrator.createScanIntent();
barcodeView.initializeFromIntent(intent);

这就解决了问题。很久以前:)


有人知道我是否可以将扫描设置为pdf417格式。是的,但是。。我在自定义布局中使用它,因此我需要使用条形码视图通过使用IntentIntegrator,我无法自定义显示全屏条形码阅读器的视图
IntentIntegrator integrator = new IntentIntegrator(this); 
integrator.setDesiredBarcodeFormats(IntentIntegrator.PDF_147);
intent = integrator.createScanIntent();
barcodeView.initializeFromIntent(intent);
private BarcodeCallback callback = new BarcodeCallback() {
            @Override
            public void barcodeResult(BarcodeResult result) {
                if (result.getText() != null) {
                    String barcodeResult = result.getText();
                    String barcodeFormat = result.getBarcodeFormat().toString();
                    if (barcodeFormat.equals("PDF_417")) {
                        try {
                            String barcodeEncodedResult = new ConvertUtil().encodeIntoBase64(barcodeResult);
                            processEncodedResult(barcodeEncodedResult);
                        } catch (UnsupportedEncodingException e) {
                            e.printStackTrace();
                        }
                    } else {
                        Toast.makeText(getActivity(), "Unable to read as PDF_417 barcode format", Toast.LENGTH_LONG).show();
                    }
                }
            }