Does anyone know how to pass value in webview using post method?
engine = (WebView) findViewById(R.id.web_engine);
engine.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
});
engine.getSettings().setJavaScriptEnabled(true);
engine.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
engine.loadUrl(url+"?ref=api&uname="+id+"&pass="+pass);
This is the way I am sending the data using get method, I want to use Post method.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With