Android & Wordpress Help center

Send POST data to WebView urls

In order to send POST data in the url being loaded inside a WebView, instead of using the loadUrl(“”) method postUrl() method can be used.

Documentation :

public void postUrl (String url, byte[] postData)
Since: API Level 5

Load the url with postData using “POST” method into the WebView. If url is not a network url, it will be loaded with {link loadUrl(String) instead.
url The url of the resource to load.
postData The data will be passed to “POST” request.

Code snippet :

WebView mWebView = (WebView) findViewById(; // WHERE is of course webview in your layout file.


Here first param to the postUrl() method is ‘url’ to which we want to send the data & the second parameter is the POST data. Since second param is of type bytes we have used ‘getBytes’ method of EncodingUtils class to get bytes from our POST data.


Single Post Navigation

4 thoughts on “Send POST data to WebView urls

  1. My spouse and I absolutely love your blog and find the majority of your post’s to be exactly what I’m looking for. Would you offer guest writers to write content available for you? I wouldn’t mind creating a post or elaborating on a number of the subjects you write about here. Again, awesome weblog!

    • thanks for the like… keep visiting for more tutorials… you can certainly mail [] me your content and i assure you to post it if its worthwhile 🙂

  2. Hi, Neat post. There’s a problem with your site in internet explorer, may test this� IE still is the market leader and a large element of folks will leave out your fantastic writing due to this problem.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: