【问题标题】:Android - Scandit Barcode Scanner issues with EAN-13Android - EAN-13 的 Scandit 条码扫描器问题
【发布时间】:2014-06-13 21:18:18
【问题描述】:

我在我的 google glass 项目中实现了 scandit 库,但如果我正在扫描 EAN-13 条形码,最后一位数字总是错误的。 例如:我正在扫描一个值为 2220141633626 的代码,结果是 2220141633624。

这是我在活动 1 中的代码:

public void didScanBarcode(String content, String format) {
    // send the result to another activity.
    Intent resultIntent = new Intent(this, TestingActivity.class);
    resultIntent.putExtra("scanContent", content);
    Log.v("scanbarcode", content);
    startActivity(resultIntent);
}

这是我在活动 2 中的代码:

protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.testing);

    Intent resultIntent = getIntent();
    String scanContent = resultIntent.getExtras().getString("scanContent");
    serialNumber = Long.parseLong(scanContent);
    Log.e("string ", "" + scanContent);
    Log.e("long ", "" + serialNumber);

}

我第一次活动的didScanBarcode方法中的内容已经错了。

【问题讨论】:

    标签: android barcode google-glass barcode-scanner ean-13


    【解决方案1】:

    2220141633626 不是有效的 EAN-13 代码,而 2220141633624 是。

    前 12 个数字是实际数字,而第 13 个数字是“校验位”。 222014163362的校验位是4

    参见例如http://www.morovia.com/education/utility/upc-ean.asp,在 ean-13 字段中输入 222014163362 并按“计算”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-22
      • 1970-01-01
      • 2014-07-18
      • 2012-07-04
      相关资源
      最近更新 更多