Does anyone know how to pass value in webview using post method?
engine = (WebView) findViewById(R.id.web_engine);
engine.setWebViewClient(new WebViewClient
Try this
String url = "http://www.example.com";
String postData = "username=my_username&password=my_password";
webview.postUrl(url,EncodingUtils.getBytes(postData, "BASE64"));
Use postUrl to use POST in WebView
.
Better with Base64.encode:
String url = "http://www.example.com";
String postData = "username=my_username&password=my_password";
webview.postUrl(url,Base64.encode(postData.getBytes(), Base64.DEFAULT));
In some cases works better:
String url = "http://www.example.com";
postData = "username="+URLEncoder.encode("my_username", "UTF-8")+"&password="+URLEncoder.encode("my_password", "UTF-8");
webview.postUrl(url,postData.getBytes());
Use postUrl Method for post dat. More detail Follow This.