Friday, November 2, 2012

WebView postUrl postData

For post data to web-view using Android.

Use method postUrl  in your java code. Refer below code for post data using web-view.

import org.apache.http.util.EncodingUtils;
public class Example extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
WebView webview = new WebView(this);
String url = "";
String postData = username=my_username&password=my_password";
webview.postUrl(url",EncodingUtils.getBytes(postData, "BASE64"));

No comments:

Post a Comment