1

I'm quite new to this, I have checked for an answer at the forums here but I didn't find any answer that can really help me out. I'm trying to play a video from the res/raw folder. I have set up this code so far:

MediaPlayer mp; 

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.videoview);
    ListView l1 = (ListView) findViewById(R.id.listview);
    l1.setAdapter(new EfficientAdapter(this));
    l1.setOnItemClickListener(new OnItemClickListener() {
    //Starts up a new activity, based on what listitem you press.
    public void onItemClick(AdapterView<?> a, View v, int position, long id) {

      Intent intent = new Intent(VideoButtonActivity.this, com.example.norskattrack.VideoActivity.class);                                 

      if(position==0){
        System.out.println("Item 0");

        intent.putExtra("video", 1);
        startActivity(intent);
      }
      if(position==1){
        System.out.println("Item 1");

        intent.putExtra("video", 2);
        startActivity(intent);
      }
    }
    });
    }
Stormenet
  • 25,926
  • 9
  • 53
  • 65
  • Update; If I was not clear on what I needed help with; I need to play a video from the resource file, and add (obviously) a method to do so. I thank you all in advance! – user1805959 Nov 07 '12 at 13:03

1 Answers1

0
Uri video = Uri.parse("android.resource://com.package.app/raw/videoname");

That should let you play the video from the raw folder !

have a look at :

How to play videos in android from assets folder or raw folder?

Play Video From Raw Folder

Trying to play video from raw folder (VideoView)

All have excellent answers !

Community
  • 1
  • 1
Adnan Mulla
  • 2,872
  • 3
  • 25
  • 35