Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Playing a video stored in your resources/raw directory
VideoView myVideo = (VideoView) rootView.findViewById(R.id.definition_video_view);
//Set video name (no extension)
String myVideoName = "my_video";
//Set app package
String myAppPackage = "com.myapp";
//Get video URI from raw directory
Uri myVideoUri = Uri.parse("android.resource://"+myAppPackage+"/raw/"+myVideoName);
//Set the video URI
myVideo.setVideoURI(myVideoUri);
//Play the video
myVideo.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment