• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Can't display video in VideoView

I'm trying to play a video in a VideoView and I'm failing miserably. I'm working in an Eclipse emulator and am half expecting it not to work there, but when I install my app on my Android phone (version 2.2.1) it also fails. The error message I get is "Cannot play video. Sorry, this video cannot be played." The video is in the Raw folder. Below is my code. parsedData[3].toString() is the name of the video (without the 3gp extension) which is being extracted from a database call. What am I doing wrong?
Code:
 VideoView videoview = (VideoView) findViewById(R.id.videoView);
    videoview.setMediaController(new MediaController(this));
    String path = "android.resource://" + getPackageName() + "/R.raw/" + parsedData[3].toString();
    videoview.setVideoURI(Uri.parse(path));
    videoview.requestFocus();
 
Back
Top Bottom