How can I add a videoview with java code to a xml file ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With