Android VideoView Create


Example

Find VideoView in Activity and add video into it.

VideoView videoView = (VideoView) .findViewById(R.id.videoView);
videoView.setVideoPath(pathToVideo);

Start playing video.

videoView.start();

Define VideoView in XML Layout file.

<VideoView
    android:id="@+id/videoView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center" />