The standard way to load an URL into a WebView object is using the loadUrl method.
publicvoidloadUrl (String url)
But if we need to load an URL into the WebView submitting POST data, use instead thepostUrl method.
publicvoidpostUrl (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/
文章標籤
全站熱搜
