Android: how to run video from resource folder
<p>I have already seen the other questions similar to mine, but the problem persists.
Thanks in advance.</p>

<p>Here's the code    </p>

<pre><code>package com.akk.mysecondvideo;

import android.app.Activity;
import android.content.Context;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;

public class MySecondVideo extends Activity {

Context context;
MediaPlayer mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    VideoView videoView = (VideoView)findViewById(R.id.VideoView);
    //MediaController mediaController = new MediaController(this);
    // mediaController.setAnchorView(videoView);
    //videoView.setMediaController(mediaController);

    Uri uri = Uri.parse("android.resource://com.akk.mysecondvideo/"
            + R.raw.bommarillu);

    videoView.setVideoURI(uri);

    //mp = new MediaPlayer();
    //mp = MediaPlayer.create(context, R.raw.bommarillu);


    videoView.start(); 
}
}
</code></pre>

<p>It shows a force close when i try to run it, and the logcat shows error <code>NULLPOINTEREXCEPTION</code> in line 28 which is <code>videoView.setVideoURI(uri);</code></p>

<p>VideoView is part of main.xml.
The main.xml file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
&gt;
&lt;VideoView 
     android:layout_height="fill_parent"
     android:layout_width="fill_parent" 
     android:id="@+id/VideoView" /&gt;
&lt;/LinearLayout&gt;
</code></pre>
