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/ 

文章標籤
全站熱搜
創作者介紹
創作者 本熊 的頭像
本熊

經驗交流分享與備忘

本熊 發表在 痞客邦 留言(0) 人氣(1,874)