我的应用程序使用ZXing条形码扫描器,使用ZXing助手类IntentIntegrator和IntentResult。
现在我发现不再有ZXing提交的扫描结果,相关返回值为空/null。
因此,我更新到了最新的帮助器类http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java和http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentResult.java
现在,我的onActivityResult方法在ZXing启动后立即被调用--当然,结果又是空的。
我的代码非常简单,扫描是这样开始的:
if (v==scanButton)
{
com.google.zxing.integration.android.IntentIntegrator integrator = new IntentIntegrator(this);
integrator.initiateScan();
}并以这种方式获取结果:
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代码。你知道为什么它不再工作了吗?
发布于 2012-11-14 17:24:20
同时,我发现:这似乎是一个依赖于安装的问题。在我的Android设备上,我可以看到这个问题,但它不能重现,我的应用程序的其他用户不会遇到这个问题。ZXing代码本身在很长一段时间内都没有改变,用户确认它也可以工作--所以这看起来是一个非常丑陋的bug。
这是从Playstore安装的ZXing-code,还没有在我的应用程序中包含ZXing进行测试。
https://stackoverflow.com/questions/12991324
复制相似问题