0

I am trying to play an youtube video inside an android app by using the url of the video.I have tried using the following code:

new Thread(new Runnable() {
            @Override
            public void run() {
                 myWebView = (WebView) findViewById(R.id.webView1);
                myWebView.setWebViewClient(new WebViewClient());
                myWebView.getSettings().setJavaScriptEnabled(true);
                myWebView.setWebChromeClient(new WebChromeClient());

                try {

                    myWebView.loadUrl(icobj.video_URL);  



                } catch (Exception e) {
                    e.printStackTrace();

                }       
            }       
        }).start();

It works, but the problem is that there is a black screen shown for about 4 seconds before the page opens.How do i get rid of the black screen before the page opens?

user3852672
  • 285
  • 1
  • 8
  • 17

1 Answers1

0

Check this link. You can listen the webview and show a placeholder or progress bar until loaded. It is all up to you.

Community
  • 1
  • 1
Seyf
  • 889
  • 8
  • 16