1.Create A New Project
Layout
--------------->Main_Activity
------------------>Drag and drop Button and Video View from Palette
---------------------->Make Button name Start and add onClickMethod
2.Add 3.gp into raw folder
res
----------------------->Right click res then create raw folder
---------------------------->Add 3.gp into raw
--------------------------------->src file
Click the image
coding:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
vid=(VideoView)findViewById(R.id.videoView1);
Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.zz);
vid.setVideoURI(uri);
vid.setMediaController(new MediaController(this));
vid.requestFocus();
}
public void play(View v)
{
vid.start();
}
3.Run your Project
-------------------->Click start button then video will be play
-------------------------->Click Video then Videocontroller will be display
Thank you...........!
No comments:
Post a Comment