Playing a Video in your App
Author: Ian Darwin
You want to play a Video in your application, as opposed to launching a media player application using an Intent (as shown in 1651).
The simplest way is to use a VideoView and call its setVideoURI method.
You will typically create the layout in XML, so just add a VideoView element in the XML layout.
Then, in your onCreate() method, find the VideoView. Call its setVideoURI() method, and call its start() method. You are finished!
You can optionally pass in a MediaController if you wish the user to have the player controls (which they have to know to activate by tapping on the video pane). Use setMediaController; create a MediaController using the Activity in the constructor.
VideoView vw = (VideoView) findViewById(R.id.onboard_videoView);
The VideoURI can be on the SD Card, in the res/raw or assets folder, or off-device if is is in a format that supports streaming. Make sure your video is in a supported format; see the official documentation for details on what video formats and CODECs are supported in various versions of Android.
That's all you have to do.