0

In my Android app, I have need to show a webpage in a WebView, using the URL obtained from my server. However, it sometimes shows OK but sometimes shows an error page (a .NET-style yellow page stating "Server Error in /Web Application").

I want to do something in my app to identify that error and redirect to another page, but how do I recognize the error?

Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
topxebec
  • 1,417
  • 3
  • 15
  • 29

1 Answers1

1

See How to retrieve HTML content from WebView (as a string)

Check the HttpResponse code and see if there's error returned.

Take note of the comment to avoid consuming double of the bandwidth required, make a HttpRequest and load it into the WebView if there's not error.

Community
  • 1
  • 1
SteD
  • 13,909
  • 12
  • 65
  • 76