安卓webview post传值问题

比如要传过去的键值对分别为 user_name = abc, password = 123456;

String postdata = "user_name=abc&password =123456";

mWebView.postUrl(url,EncodingUtils.getBytes(postData, "BASE64"));


如果把键值对存在了一个map里面,那么就用以下正则表达式,转化成一个字符串,

String postData = map.toString().replaceAll("[{}]", "").replace(",", "&");

mWebView.postUrl(url,EncodingUtils.getBytes(postData, "BASE64"));

这样就可以把这个值post过去了。



你可能感兴趣的:(webView)