我的应用程序利用ZXing条形码扫描器使用ZXing助手类IntentIntegrator和IntentResult。Android/ZXing不再有效
现在我发现ZXing不再提供扫描结果,相关返回值为空/空。
因此我更新到最新的辅助类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方法被称为斑马线开始后不久 - 当然有一个空的结果一次。
我的代码非常简单,在开始扫描是这样的:
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());
}
}
}
在我的Android最新的斑马线代码安装。任何想法为什么它不再工作?
集成和意图的代码在一段时间没有改变,并能正常工作为了我。如果您仍然认为有问题,您必须多说几句。我怀疑一个流氓应用程序拦截了Barcode Scanner的意图。 –
我不能说比这更多:这段代码对我很好,没有问题。最近我再次测试了同一个App,发现IntentResult不会返回任何东西。这就是为什么我更新到IntentIntegrator/IntentResult的最新版本,以便在ZXing仍在运行的情况下,Intent在没有内容的情况下立即返回。其他人使用完全相同的应用程序不会遇到这些问题 - 那么我还能测试什么? – Elmi
@Elmi同样的问题在这里,你找到了解决办法? –