title: Playing a video using VideoView in Android Eclipse
body: <p>I am trying to play a video using VideoView. I get a force close message when I run my app. Somebody please help me. The following is my code.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" &gt;
  
  &lt;VideoView
      android:id="@+id/videoView1"
      android:layout_width="match_parent"
      android:layout_height="328dp" /&gt;
  
  &lt;Button
      android:id="@+id/button1"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/play" /&gt;
  
  
  &lt;Button
      android:id="@+id/button2"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/pause" /&gt;
  
  &lt;Button
      android:id="@+id/button3"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:text="@string/stop" /&gt;
  
  &lt;/LinearLayout&gt;
  
  
  package ram.videoplayer;
  
  import android.app.Activity;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.VideoView;
  
  
  public class VideoplayerActivity extends Activity {
  /** Called when the activity is first created. */
  
  VideoView vv;
  View v;
  int id;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      vv = (VideoView)findViewById(R.id.videoView1);
      Uri u = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.v);
      vv.setVideoURI(u);
  
      id = v.getId();
  
      switch (id) {
  
      case R.id.button1:
          vv.start();
          break;
  
      case R.id.button2:
          vv.pause();
          break;
  
      case R.id.button3:
          vv.stopPlayback();
          break;
  
         } 
      }
  }
  </code></pre>
  
  <p>Initially this was my code. It wasn't working. Then I tried to reduce my code and I deleted all the three buttons I was using. I was using <code>vv.start();</code> straight away without any button clicks. I had bid of success when I did so. I was able to hear my video running. But unfortunately I could see no video on my screen. Then I modified my code. I used <code>vv.setVideoPath("/sdcard/v.mp4");</code> instead of the <code>Uri</code> statements. It resulted in a "can't play video" message. I searched for answers. I have found no satisfying answers so far. I am using android 2.2 and when I was on my hunt I found some statements like " <code>vv.setVideoPath("/sdcard/v.mp4");</code> won't work in android 2.2" So I have 3 questions now.</p>
  
  <ol>
  <li>Will <code>setVideoPath()</code> really won't work in android 2.2 ?</li>
  <li>Why couldn't I see my video when I was using Uri ?</li>
  <li>What went wrong when I added buttons to my code ?</li>
  </ol>
  
  <p>Please help me.</p>
  
  <p>Thanks in advance. </p>