【问题标题】:Zxing Embedded Barcode Reader using (BarcodeView)Zxing嵌入式条码阅读器使用(BarcodeView)
【发布时间】:2018-08-16 16:06:22
【问题描述】:

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

这是我的代码的 sn-p

 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) {
            }
        };

这里是图书馆

compile 'com.journeyapps:zxing-android-embedded:3.3.0'

【问题讨论】:

  • 任何人都知道我是否可以将扫描设置为 pdf417 格式。

标签: java android zxing barcode-scanner pdf417


【解决方案1】:

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

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();
                    }
                }
            }

【讨论】:

    【解决方案2】:

    您可以将格式传递给 Intent 积分器进行扫描。类似的东西:

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

    【讨论】:

    • 是的,但是.. 我在自定义布局中使用它,所以我需要使用 BarcodeView
    • 使用 IntentIntegrator 我无法自定义显示全屏条形码阅读器的视图
    猜你喜欢
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多