title: Android: Programmatically created VideoView is showing black screen
body: <p>So I have a <code>VideoView</code> that I have made completely programmatically like so:</p>
  
  <pre><code>loadingVideo = new VideoView(getContext());
  String videoPath = "android.resource://" + splashActivity.getPackageName() + "/" + R.raw.loading_video;
  loadingVideo.setVideoURI(Uri.parse(videoPath));
  loadingVideo.setLayoutParams(new FrameLayout.LayoutParams(Constants.PIXEL_WIDTH, Constants.PIXEL_HEIGHT));
  loadingVideo.setTranslationX(0);
  loadingVideo.setTranslationY(0);
  loadingVideo.start();
  this.widgetContainer.addView(loadingVideo);
  </code></pre>
  
  <p>I know the video is doing something because I later have an <code>OnCompletionListener</code> that does go off, the problem is that I don't ever actually see anything and just get a black screen. I draw the method here:</p>
  
  <pre><code>if(loadingVideo.isPlaying()) {
      loadingVideo.draw(canvas);
      System.out.println();
  }
  </code></pre>
  
  <p>and the <code>draw(Canvas canvas)</code> method is refreshed at a rate of 60fps using this:</p>
  
  <pre><code>Canvas canvas = null;
  SurfaceHolder sh = getHolder();
  boolean unlocked = false;
  try {
      if(sh.getSurface().isValid()) {
          canvas = sh.lockCanvas();
          synchronized(sh) {
              draw(canvas);
          }
      }
  } catch(Exception e) {
      if(canvas != null &amp;&amp; sh.getSurface().isValid()) {
          sh.unlockCanvasAndPost(canvas);
          unlocked = true;
      }
      e.printStackTrace();
  } finally {
      if(!unlocked &amp;&amp; canvas != null &amp;&amp; sh.getSurface().isValid()) {
          sh.unlockCanvasAndPost(canvas);
      }
  }
  </code></pre>
  
  <p>I don't understand why it isn't drawing or what I'm doing wrong.</p>
  
  <p>Side note: I know that the way I'm doing this seems odd but I know it works because I've created other views this way in other projects and they've worked fine. I just can't get the video to show anything other than a black screen.</p>