title: RuntimeException when using VideoView in WebView - Android
body: <p>I know there are lot of questions asked around this topic but none of them helped me :(
  I am trying to call a java method to play video in VideoView on passing a parameter through a WebView, but I am running into following issues:</p>
  
  <ol>
  <li>In activity_main, when I have VideoView tag inside WebView then I am getting a blank black screen, basically my HTML is not getting loaded.</li>
  <li>In activity_main, when I do not use VideoView but WebView only then my HTML gets displayed but I get Uncaught Error on instantiating the VideoView using VideoView vv = new VideoView( this ).</li>
  <li>On using Relative or Linear Tag around WebView and VideoView tags not letting the application to start.</li>
  </ol>
  
  <p>Can somebody help me in refining my activty_main.xml to get this code working? Please find below my code snippets:</p>
  
  <p>My activity_main.xml:</p>
  
  <pre><code>    &lt;WebView  xmlns:android="http://schemas.android.com/apk/res/android" 
                    android:id="@+id/WebView123"     
                    android:layout_width="fill_parent"      
                    android:layout_height="fill_parent"      
                    android:layout_weight="1.0"    &gt;
                &lt;!--On removing this VideoView, HTML getting displayed but Video not gettin launched
                    &lt;VideoView android:id="@+id/videoView"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" 
                    /&gt;
                    &lt;/WebView&gt;
  </code></pre>
  
  <p>My MainActivty.java</p>
  
  <pre><code>                         public class MainActivity extends Activity {
  
           WebView browser;
  
              @Override
            protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      browser = (WebView) findViewById(R.id.WebView123);
      WebSettings webSettings = browser.getSettings(); 
      webSettings.setJavaScriptEnabled(true); 
      webSettings.setPluginState(WebSettings.PluginState.ON_DEMAND); 
      webSettings.setAllowFileAccessFromFileURLs(true);  
      browser.setWebChromeClient(new WebChromeClient());  
      browser.setWebViewClient(new WebViewClient(){
                  @Override
                  public boolean shouldOverrideUrlLoading(browser , String url) {
                  return false;
                   }
                   });
                  MainActivity jsInterface = new MainActivity();
      browser.addJavascriptInterface(jsInterface, "interfaces");
      browser.loadUrl("file:///android_asset/index.html");
      setContentView(browser);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @JavascriptInterface
  public void videoPlayer(String identifer){
      System.out.println("Hey I am in Here");
    // 2nd Point - &gt;  VideoView videoHolder = new VideoView(this);
      VideoView videoHolder = (VideoView) findViewById(R.id.videoView);
  
      MediaController mc = new MediaController(this);
      mc.setAnchorView(videoHolder);
      videoHolder.setMediaController(mc);
      if(identifer.equals("1")){
          String path = "android.resource://" + R.raw.intro;
          videoHolder.setVideoURI(Uri.parse(path));
           }
         videoHolder.start();
         videoHolder.requestFocus();
            }
                } //class end
  </code></pre>
  
  <p>My HTML for WebView:</p>
  
  <pre><code>                 &lt;button onClick="window.interfaces.videoPlayer('1');"&gt;Button&lt;/button&gt; 
  </code></pre>