android - How to get server response code for redirecting response on WebView -


itemprop = "text">

I set a 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??}});

You looked up, URL in my code 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'   

In the above case, WebView shows the page " Bad title value: 'name' ".

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 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); }    

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

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -