extraHeaders = new HashMap();
// extraHeaders.put("Referer", "http://zxpay.fss518.cn");
// view.loadUrl(url, extraHeaders);
// return true;
// }
//H5调起微信app支付方法二(可使用)
if (url.startsWith("weixin://wap/pay?")) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
}
if(url.startsWith("alipays:") || url.startsWith("alipay")) {
try {
startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));
} catch (Exception e) {
new AlertDialog.Builder(MainActivity.this)
.setMessage("未检测到支付宝客户端,请安装后重试。")
.setPositiveButton("立即安装", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri alipayUrl = Uri.parse("https://d.alipay.com");
startActivity(new Intent("android.intent.action.VIEW", alipayUrl));
}
}).setNegativeButton("取消", null).show();
}
return true;
}
if (!(url.startsWith("http") || url.startsWith("https"))) {
return true;
}
view.loadUrl(url);
return true;
}
});
}