Two ways to load post response in webview:
-
webview.loadData()
: Like what you have posted in your solution. But “content loaded through this mechanism does not have the ability to load content from the network”. -
webview.postUrl()
: Use this if post response needs to load content from the network. (NOTE: only accessible from api-level 5, which means no android 1.6 or lower)
String postData = "username=my_username&password=my_password";
webview.postUrl(url,EncodingUtils.getBytes(postData, "BASE64"));
(source: http://www.anddev.org/other-coding-problems-f5/webview-posturl-postdata-t14239.html)