HTTP POST response into WebView in android

前端 未结 2 724
天涯浪人
天涯浪人 2020-12-06 13:17

I\'m attempting to connect to the page using an HTTP Post. I do an http post for creating a webview. i need to redirect to another page from the webview. But when the cont

相关标签:
2条回答
  • 2020-12-06 13:39

    Use like this

    WebView webview = new WebView(this);
    setContentView(webview);
    byte[] post = EncodingUtils.getBytes("postvariable=value&nextvar=value2", "BASE64");
    webview.postUrl("http://www.geenie.nl/AnHeli/mobile/ranking/demo/index.php", post);
    
    0 讨论(0)
  • 2020-12-06 13:57

    I'm not sure if this is where your failing, or if this will cause an error, but since you're doing a POST, remove the "?" at the end of your URL_REGISTER variable.

    private final String URL_REGISTER = "https://www.paypal.com/checkout?";
    

    "?" is only needed when doing a GET request.

    David

    0 讨论(0)
提交回复
热议问题