【问题标题】:How can I use zxing to create a standalone barcode reader?如何使用 zxing 创建独立的条码阅读器?
【发布时间】:2012-06-25 20:25:18
【问题描述】:

我想使用ZXing 制作一个Android 应用。谁能告诉我如何使用核心库,或者谁知道如何使用核心库来构建条码扫描器?

【问题讨论】:

标签: android barcode zxing


【解决方案1】:

您需要在 Activity 中调用 Zxing Intent 并放松。

首先添加调用Intent的代码:

IntentIntegrator integrator = new IntentIntegrator(yourActivity);
integrator.initiateScan();

其次,将此添加到您的 Activity 以处理结果:

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
  if (scanResult != null) {
    // handle scan result
  }
  // else continue with any other code you need in the method
  ...
}

花时间浏览Zxing的wiki页面。他们解释得很好。

http://code.google.com/p/zxing/w/list

http://code.google.com/p/zxing/wiki/ScanningViaIntent

这里是演示如何调用 Zxing 意图的示例应用程序。

http://code.google.com/p/zxing/source/browse/trunk/androidtest/src/com/google/zxing/client/androidtest/ZXingTestActivity.java

最终测试项目+库位于

http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fandroid-integration%253Fstate%253Dclosed

【讨论】:

  • 是否可以无意识地扫描条形码?我想将 zxing 的代码与我的应用程序合并。如何知道zxing的功能细节?
  • 你能告诉我条形码的编码吗?假设我想做一个通用的条码阅读器,ZXing 有 qr_mode、product_mode 和 one_d_mode 三种扫描模式。如何将这些解码集成到单扫描模式中。
猜你喜欢
  • 1970-01-01
  • 2012-06-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多