首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android / ZXing不再工作

Android / ZXing不再工作
EN

Stack Overflow用户
提问于 2012-10-21 02:16:00
回答 1查看 935关注 0票数 4

我的应用程序使用ZXing条形码扫描器,使用ZXing助手类IntentIntegrator和IntentResult。

现在我发现不再有ZXing提交的扫描结果,相关返回值为空/null。

因此,我更新到了最新的帮助器类http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.javahttp://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentResult.java

现在,我的onActivityResult方法在ZXing启动后立即被调用--当然,结果又是空的。

我的代码非常简单,扫描是这样开始的:

代码语言:javascript
复制
  if (v==scanButton)
  {
     com.google.zxing.integration.android.IntentIntegrator integrator = new IntentIntegrator(this);
     integrator.initiateScan();
  }

并以这种方式获取结果:

代码语言:javascript
复制
public void onActivityResult(int requestCode, int resultCode, Intent intent) 
{
  com.google.zxing.integration.android.IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
  if (scanResult != null) 
  {
     String format;

     format=scanResult.getFormatName();
     if ((format!=null) && (format.length()>0))
     {
         if ((format.equals("EAN_8")) || (format.equals("EAN_13")) ||(format.equals("UPC_A")) ||(format.equals("UPC_E")))
          getEANData(scanResult.getContents());
     }   
 }
}    

在我的安卓系统上,安装了最新的ZXing代码。你知道为什么它不再工作了吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-14 17:24:20

同时,我发现:这似乎是一个依赖于安装的问题。在我的Android设备上,我可以看到这个问题,但它不能重现,我的应用程序的其他用户不会遇到这个问题。ZXing代码本身在很长一段时间内都没有改变,用户确认它也可以工作--所以这看起来是一个非常丑陋的bug。

这是从Playstore安装的ZXing-code,还没有在我的应用程序中包含ZXing进行测试。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12991324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档