I am trying to accomplish something quite simple, yet I have found no good documentation on this. I have a webView, and I need to load a page in it that requires POST data.
I use webView.loadData() to do client post, and it will display content of url, my code :
public static void webview_ClientPost(WebView webView, String url, Collection< Map.Entry> postData){
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append("");
sb.append(String.format("");
webView.loadData(sb.toString(), "text/html", "UTF-8");
}
use function webview_ClientPost() :
Map mapParams = new HashMap();
mapParams.put("param1", "111");
mapParams.put("param2", "222");
Collection> postData = mapParams.entrySet();
webview_ClientPost(webView1, "http://www.yoursite.com/postreceiver", postData);