Webview problems

androb

Member
Licensed User
Longtime User
I am really liking developing with basic4android it is a great product, with great support.

I am working on a project that wraps my web app inside a webview control, that works as expected. However, I am having some problems when the website is not reachable.

I have used the code provided on here to check, but this only tells me whether wifi is on or not. I want to check if the site is reachable - it can be that it isnt, eg if the user is behind a proxy or firewall. The result of this is the webview says that my site is not available in an ugly browser error message.

I have tried to write a library to patch in the "onreceivederror" event into webview, but this is evidently beyond my skill level. I don't know how to attach the event to a webview inside b4a, and my experiments so far make my app crash on startup with a "Not responding..." message.

Is there any way I can trap this event, and show the user a message rather than the webview showing some ugly hard to understand message ?

If there any way to patch in an event that will tell b4a if the webview cannot load the page and intercept it?

I have also tried using the http library to do a GET request on my site, but this does not seem to fire before the webview errors out. I guess this might be due to it running in a different thread?

Any assistance is appreciated.
 
Top