-1

Hi in my application I have to have open a webview and show the contents. For other pages it works well, but facing issue on only this page Link whenever I open this in webview nothing pops up, and i can only see a black page and nothing else. Here is my code.

mWebView = (WebView)rootView.findViewById(R.id.webview_livechat);
        setUpWebViewDefaults(mWebView);
//      mWebView.setWebChromeClient(new WebChromeClient());
        mWebView.loadUrl("http://www.zong.com.pk/livechat/chat.php?a=acb8c");
        return rootView;
    }
    @SuppressLint("SetJavaScriptEnabled")
    @TargetApi(19)
    private void setUpWebViewDefaults(WebView webView) {
        WebSettings settings = webView.getSettings();
        mWebView.setWebViewClient(new WebViewClient());
        settings.setJavaScriptEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setBuiltInZoomControls(true);
        settings.setPluginState(PluginState.ON);
        if(Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
            settings.setDisplayZoomControls(false);
            mWebView.setWebViewClient(new WebViewClient());
        }
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            WebView.setWebContentsDebuggingEnabled(true);
            mWebView.setWebViewClient(new WebViewClient());
        }
    }
DreamCoder
  • 21
  • 2

1 Answers1

0

I have tested your code in a simple activity with a WebView and it seems to be working on an emulator with Android-Version 4.4.4 (API 19). I had just to wait a few seconds.

momo
  • 3,313
  • 2
  • 19
  • 37
  • This is strange. I have tried on emulator 4.0 and Real device having android 4.4, but not working. – DreamCoder Nov 11 '14 at 10:02
  • Try to add `` to your Manifest. Does it help? – momo Nov 13 '14 at 13:03
  • Try to change your code to: ` if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {...} else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) else {...}`. By the way why do you always create a new WebViewClient? – momo Nov 19 '14 at 07:11