Skip to content Skip to sidebar Skip to footer

Web View Page Is Not Displaying Below Android 5.0 Version But Working In 5.1.1 , Only Blank Screen Is Showing In 4.4.2

Web view URL is working fine in android 5.1.1 but not in 4.4.2 version , its displaying blank screen only. Here is my code public class WebViewTwo extends Activity { WebView webVie

Solution 1:

Replace code webView.setWebChromeClient(new WebChromeClient()); with webView.setWebChromeClient(new MyWebChromeClient()); Add following code -

privateclassMyWebChromeClientextendsWebChromeClient {

        @OverridepublicvoidonConsoleMessage(String message, int lineNumber, String sourceID) {
            Log.d(TAG, message + " -- From line "
                    + lineNumber + " of "
                    + sourceID);
        }
    }

check the console log. And also check whether your url is with http or https , so can handle accordingly. it is also happened with me once and issue was found of webpage.

Solution 2:

After research I got my answer and now its running smoothly on 4.4.2.

publicclassWebViewTwoextendsActivity {

@OverridepublicvoidonCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.web_view_two);

    WebViewwebView= (WebView) findViewById(R.id.webView2);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(newHelloWebViewClient());

    webView.loadUrl("http://www.google.co.in");
}

privateclassHelloWebViewClientextendsWebViewClient {
    @OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url) {

        view.loadUrl(url);
        returntrue;
    }
}}

Post a Comment for "Web View Page Is Not Displaying Below Android 5.0 Version But Working In 5.1.1 , Only Blank Screen Is Showing In 4.4.2"