android - How to get server response code for redirecting response on WebView -
I set a You looked up, URL in my code In the above case, My question is, in my Java code, how can I get the server response code (for example, in the above case 400 ) the redirected response? ==================== What I tried ================ ========== I tried to add So far .. I think that is not the only (proper) way Java code. In fact, this is by javascript injected into your webview, in which you will be given a response code. See this WebView component, I set to a
WebViewClient Have done this:
webview webview = (webview) Find VVBID (RID.Mi_ViewView); WebView.setWebViewClient (New WebViewClient () {@Override Public Boolean shouldOverrideUrlLoading (WebView to see, string NEWURL) // // Here, I handle URL redirects. @ @ NEWURL is redirected url // How server response code here To reach??}});
shouldOverrideUrlLoading (...) handles redirect. it works fine. Occasionally, the redirect server response error message is an error code, e.g. The server logs are:
& lt; 400 & lt; Content type: Text / plain bad title value: 'name'
WebView shows the page " Bad title value: 'name' ".
onReceivedError ()
in the new WebViewClient () {...} / Code>, to capture the error response, but the code is not executed. Override public void on
@ReceivedError (Webview View, Intel Error Code, String Description, String Failed Url) {Log.v ("Error Received On": Error Code + ":" + Description); }
Comments
Post a Comment