我希望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");
}
}
}
我不知道我做错了什么
答案 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");
}
}
}