3

I have a Webview In that I am loading web with Query string perimeters like

String url = map.get("utype") + map.get("sid") + "/login/login.php?"+"&"+"strid" + "=" + map.get("strid")+"&"+"appmod" + "=" + map.get("appmod")+"&" +"ttype" + "=" + map.get("ttype")+"&" +"payp" + "=" + map.get("payp");

I am loading that Query string in webview

webView.loadUrl(url);

So Now Insted of using Query string I want to POST Parameters to x-www-form-urlencoded

These are my Parameters

strid = map.get("strid");
appmod = map.get("appmod");
ttype = map.get("ttype");
payp = map.get("payp");

I followed this but its not Working

can any one help me on this..

I want to POST data to x-www-form-urlencoded in Web-view

After posting I it will load my Web-server(website).

Update

I have Given these values for post

String postData="strid="+URLEncoder.encode(map.get("strid"), "UTF-8")+
"&appmod="+URLEncoder.encode(map.get("appmod"), "UTF-8")+
"&ttype="+URLEncoder.encode(map.get("ttype"), "UTF-8")+
"&payp="+URLEncoder.encode(map.get("payp"), "UTF-8");

Now after Adding The Details I have given this to at URL

webView.postUrl(url,postData.getBytes());

But still Its not working

can anyone suggest me whats wrong

Don't Be negative
  • 1,215
  • 3
  • 19
  • 46

1 Answers1

0

You need to call webView.postUrl(url, encodedData);

Values must be encoded with URLEncoder.encode(postData, "UTF-8") or "BASE64" depends on backend.

If its not working make sure you have url in correct format. You can also share it to here without exposing your values if you are not sure.

Emre Aktürk
  • 3,306
  • 2
  • 18
  • 30
  • Thanks for Response user@Emre Aktürk ,, But How Ever I already Tried And I have Given Reference link also... I am using `webView.postUrl(url, EncodingUtils.getBytes(postData, "UTF-8"));` – Don't Be negative Dec 17 '18 at 08:00
  • Did you solve this issue @Don'tBenegative ? I am stuck now. – viper Jan 04 '21 at 07:55