i've got an app, that has 2 types of "no internet error".
When you launch the app, it sees if you have internet and shows an error No Internet
, and i have in my webviews, a loadURL
to a custom page.
I want to hide the webview website, but with the custom page, it take a litle time, and you can see the error+the website.
Is possible to do something to my needs?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view=inflater.inflate(R.layout. fragment_paginainicio, container, false);
final WebView mWebView = (WebView) view.findViewById(R.id.webView_websitepage);
mWebView.loadUrl("https://google.pt");
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
mWebView.loadUrl("file:///android_asset/errorpage.html");
}
});