小编Mid*_*rty的帖子

无法使用谷歌条码扫描仪

我从https://github.com/googlesamples/android-vision尝试了谷歌条码阅读器

此示例不起作用.当我选择屏幕时,它总是会检测到

"没有检测到条形码"

调试原因:

private boolean onTap(float rawX, float rawY) {

    //TODO: use the tap position to select the barcode.
    BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
    Barcode barcode = null;
    if (graphic != null) {
        barcode = graphic.getBarcode();
        if (barcode != null) {
            Intent data = new Intent();
            data.putExtra(BarcodeObject, barcode);
            setResult(CommonStatusCodes.SUCCESS, data);
            finish();
        }
        else {
            Log.d(TAG, "barcode data is null");
        }
    }
    else {
        Log.d(TAG,"no barcode detected");
    }
    return barcode != null;
}
Run Code Online (Sandbox Code Playgroud)

graphic 变量总是如此 Null

看图像:

Android工作室上的图像

有谁遇到过这个问题?你能告诉我怎么解决吗?非常感谢!

android android-vision

5
推荐指数
1
解决办法
1032
查看次数

标签 统计

android ×1

android-vision ×1