In my Android application I have a WebView which loads a website URL with specific data as querystring in address. I don't want simple users to be aware of passed querystrings.
However I check for Internet availability programmatically before processing the WebView, sometimes for other reasons as well as problem in browser setting or low quality Internet service etc. the webpage fails to load and WebView displays the following error:
Webpage not available
the webpage at http://www.example.com/?q=43345876987&h=sdtkljdflku324kj might be temporarily down or it may have moved permanently to a new web address
Is there any way to catch the error by Android programmatically before user and display a user friendly message instead?
My current code:
if (isOnline()){
WebView channelmanager=(WebView) findViewById(R.id.channelmanager);
channelmanager.getSettings().setJavaScriptEnabled(true);
channelmanager.getSettings().setDomStorageEnabled(true);
channelmanager.loadUrl(url);
}
else
{
Toast.makeText(getBaseContext(), "Connection unavailable", 7000).show();
}