does anyone know why webview displaying white page? Here is the code
webView = (WebView) this.findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(THE_URL);
webView.setWebViewClient(new WebViewClient());
and this functions is also called:
@Override
public void onPageFinished(WebView view, String url) {
}
am I missing something there? Of course, the error is not from the XML, because the webview only does not display some URL.
Thanks
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. In the above code, we have taken web view to show html content.
Alternatives to WebView If you want to send users to a mobile site, build a progressive web app (PWA). If you want to display third-party web content, send an intent to installed web browsers. If you want to avoid leaving your app to open the browser, or if you want to customize the browser's UI, use Custom Tabs.
Enhance webView performance - disable the WebView cache to make WebView much faster. Supercharging the Android WebView - cache critical assets that drastically reduce the load time.
If you want to deliver a web application (or just a web page) as a part of a client application, you can do it using WebView . The WebView class is an extension of Android's View class that allows you to display web pages as a part of your activity layout.
For anyone still having this issue, it seems that the WebViewClient does not warn you if a secure connection via https has failed. This is likely due to an SSL error on the server you are connecting to.
You can try using http instead if the server allows it.
Refer this link. In your code you are creating two webview clients simultaneously.
mwebview=(WebView)findViewById(R.id.webview);
mwebview.getSettings().setJavaScriptEnabled(true);
mwebview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
mwebview.loadUrl(webUrl);
mwebview.setWebChromeClient(new WebChromeClient() );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With