[source code] Android Development Tutorial - 55

+8 Bucky Roberts · January 7, 2015

activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <VideoView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/buckysVideoView" />
</RelativeLayout>


MainActivity.java
package com.thenewboston.videoplayer;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.widget.VideoView;
import android.widget.MediaController;

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final VideoView buckysVideoView = (VideoView) findViewById(R.id.buckysVideoView);
        buckysVideoView.setVideoPath("https://www.thenewboston.com/forum/project_files/006_testVideo.mp4");

        //Player controls(play, pause, stop, etc...)
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(buckysVideoView);
        buckysVideoView.setMediaController(mediaController);

        buckysVideoView.start();
    }

}

Post a Reply

Replies

Oldest  Newest  Rating
0 Tijani Babatunde · January 7, 2015
Hey Travis, I have been following your tutorials on Android Application. right now am working on an app that can send bulksms using the internet. the problem am having is that i don't know how to reference it in java. Please I need your help. 

Thanks for putting up those free tutorials, they are really amazing.
0 Amit . · January 7, 2015
Tijani Babatunde ·those are old tutorials, Travis left. He is Bucky Roberts and there is a new Android app development series going on.

 About your problem I think Bucky can still help :)
0 Ahmed Sahib · January 7, 2015
Why can't I see these videos on youtube...??
I've tried refreshing quite a few times but still... This hasn't happend before...
BTW these tutorials have been just amazing...
+2 Lukas Tamkun · January 8, 2015
Seems like these are not uploaded yet :/
0 Milan Obrenovic · January 8, 2015
Where is this tutorial?!
0 Lukas Tamkun · January 10, 2015
Now they are :)
  • 1

Java / Android Development

106,968 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator