Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How add a videoview programmatically

Tags:

java

android

How can I add a videoview with java code to a xml file ?

like image 934
Gonçalo Ribeiro Avatar asked Feb 12 '14 00:02

Gonçalo Ribeiro


1 Answers

Here is the code i excepted that you are using RelativeLayout in your xml layout

RelativeLayout layout = (RelativeLayout) findViewById(R.id.layout);
    VideoView video = new VideoView(this);
    video.setVideoURI("yourURI");
    video.setLayoutParams(new FrameLayout.LayoutParams(550, 550));
    layout.addView(video);

feel free to feed me in any thing not obvious for you

like image 101
mohammed momn Avatar answered Nov 09 '22 00:11

mohammed momn