【问题标题】:ZXing only recognizes QR-CodeZXing 只识别二维码
【发布时间】:2016-01-04 19:08:37
【问题描述】:

我正在尝试使用ZXing library 为谷歌眼镜开发条形码扫描仪(不要判断)。

扫描 QR 码可以正常工作,但我无法扫描任何一维条码。

这是我的代码:

Intent intent = new Intent(this, CaptureActivity.class);
//intent.putExtra("SCAN_MODE", "PRODUCT_MODE"); //doesn't work with or without this line
startActivityForResult(intent, SCAN_REQUEST);

这是一个示例 (EAN-8):

使用 PlayStore 中的扫描仪进行扫描可以在我的手机上使用,但不能在玻璃上使用我的应用程序。

【问题讨论】:

    标签: zxing google-glass barcode-scanner


    【解决方案1】:

    我在 DecodeRunnable.java 中找到了我的问题的解决方法。
    通过将BarcodeFormat.EAN_8 添加到下面代码的列表中,我能够扫描条形码。

    DecodeHandler() {
      hints = new EnumMap<>(DecodeHintType.class);
      hints.put(DecodeHintType.POSSIBLE_FORMATS,
          Arrays.asList(BarcodeFormat.AZTEC, BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX));
    }
    

    欢迎您发布您的答案,因为我相信有更好的方法来解决这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多