title: Play Video From Raw Folder
body: <p>Evening,</p>
  
  <p>I've just started programming with android and made a few programs and everything so I'm still kind of a novice but im trying to understand it all.</p>
  
  <p>So here's my problem, I'm trying to play a video, the thing is, I got it working when I Stream it from an URL with VideoView over the internet or when i place in on my sdcard.</p>
  
  <p>What I want to do now is play a video I've got in my res/raw folder, but it only plays audio and I don't understand why, it doesn't give any error in my logcat as far as I can see, also couldn't really find a solution with google since most of the answers are about VideoView and just put the video on your SDCard.</p>
  
  <p>Now someone told me I had to use setDisplay (SurfaceHolder) and I've also tried that but I still only get the audio.</p>
  
  <p>I hope somebody can help me to find a solution to this problem.</p>
  
  <p>VideoDemo.java</p>
  
  <pre><code>package nl.melvin.videodemo; 
  
  import android.app.Activity; 
  import android.os.Bundle; 
  import android.media.MediaPlayer; 
  import android.view.SurfaceHolder; 
  import android.view.SurfaceView; 
  
  
  public class videodemo extends Activity { 
  
      public SurfaceHolder holder; 
      public SurfaceView surfaceView; 
  
  
      /** Called when the activity is first created. */ 
      @Override 
      public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.main); 
  
  
          MediaPlayer mp = MediaPlayer.create(this, R.raw.mac); 
  
          mp.setDisplay(holder); 
          mp.start(); 
  
        } 
  
  } 
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
  
  &lt;LinearLayout  
      xmlns:android="http://schemas.android.com/apk/res/android" 
       android:id="@+id/LinearLayout01"  
       android:layout_width="fill_parent"  
       android:layout_height="fill_parent" &gt; 
      &lt;SurfaceView 
          android:id="@+id/surfaceview" 
           android:layout_width="fill_parent" 
           android:layout_height="fill_parent"&gt; 
       &lt;/SurfaceView&gt;&gt; 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I've also tried Uri.parse but it says it can't play the video (.mp4 format).</p>