在我的WebView中自动上传扫描的网页QRCODE?

时间:2015-12-22 19:53:02

标签: android webview camera android-camera qr-code

我希望WebView自动加载扫描的QR码 我的代码看起来像这样

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        if (requestCode == 0) {
            if (resultCode == RESULT_OK) {
               String contents = intent.getStringExtra("SCAN_RESULT");
                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
                Log.i("Barcode Result", contents);
                WebView.loadUrl("SCAN_RESULT");
            } else if (resultCode == RESULT_CANCELED) {
                Log.i("Barcode Result","Result canceled");
            }
        }
    }

我不知道我做错了什么

1 个答案:

答案 0 :(得分:0)

当有人在webview中自动加载QR CODE时出现问题 把它放下工作很好

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
           String contents = intent.getStringExtra("SCAN_RESULT");
            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            Log.i("Barcode Result", contents);
            WebView.loadUrl(intent.getStringExtra("SCAN_RESULT"));
        } else if (resultCode == RESULT_CANCELED) {
            Log.i("Barcode Result","Result canceled");
        }
    }
}