My layout that contains videoView
Java
// Get VideoView in layout xml
VideoView mVideoView = (VideoView) findViewById(R.id.videoView);
// MediaController provide controller, contains the buttons
// like "Play/Pause", "Rewind", "Fast Forward" and a progress slide
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(mVideoView);
mVideoView.setMediaController(mediaController);
mVideoView.setVideoPath("/path/to/your/videofile");
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mVideoView.start();
}
});