The standard way to load an URL into a WebView object is using the loadUrl method.

public void loadUrl (String url)

But if we need to load an URL into the WebView submitting POST data, use instead thepostUrl method.

public void postUrl (String url, byte[] postData)

To create the POST data, use a string and encode it.

1
2
3
4
5
String postData = "submit=1&id=236";
 
webview.postUrl(
    EncodingUtils.getBytes(postData, "BASE64"));

 

本文取自  http://belencruz.com/2012/12/do-post-request-on-a-webview-in-android/ 


文章標籤
創作者介紹

經驗交流分享與備忘

Frank 發表在 痞客邦 PIXNET 留言(0) 人氣()