How can I get the JSON response of a POST request in a WebView?

前端 未结 3 1999
我在风中等你
我在风中等你 2020-12-05 03:41

I\'ve got a WebView with html containing a form (post). When clicking some submit button I get a JSON response.

How can I get this JSON?

If I do

3条回答
  •  既然无缘
    2020-12-05 03:52

    Well, the short answer is that it works quite similar to shouldOverrideUrlLoading(WebView view, String url), as illustrated in the WebView tutorial.

    To get you started, see the code below. You simply override the shouldInterceptRequest(WebView view, String url) method of your WebViewClient. Obviously you don't have to do that inline, but for the sake of compactness that's what I did:

    Take a look at this.

提交回复
热议问题