Code to Play Video on Android

Screen Shot 2014-12-30 at 5.45.08 PM

There is plenty of multimedia API in the Android development kits. You can use any class or method that suit your project and apps development. Android is based on linux, the multimedia API is documented in the Google Android SDK website.

You can use VideoView class to play the video on Android devices, set the setVideoURI string, put the MP4 video in /res/raw folder and finally use start() method to play the video. Here is the code snippet to play the video on Android.



public class PlayVideo extends Activity {

privatestaticfinalintREQUEST_CODE = 0;

VideoView vv;


public void onCreate(Bundle savedInstanceState) {






        LinearLayout layout = (LinearLayout) findViewById(;




    VideoView vv = (VideoView)this.findViewById(;

    String uri = "android.resource://" + "" + "/" + R.raw.scare;





Code to Play Video on Android Code to Play Video on Android Reviewed by Admin on 1:45 AM Rating: 5

No comments:

Powered by Blogger.