Guest User

MainActivity.java

a guest
Mar 29th, 2017
9,777
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.okedroid.contohaplikasi;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.widget.MediaController;
  6. import android.widget.VideoView;
  7.  
  8.  
  9. /*
  10. Fathurrahman (okedroid.com)
  11.  */
  12. public class MainActivity extends AppCompatActivity {
  13.  
  14.     VideoView videoView;
  15.     //deklarasi obj
  16.  
  17.     @Override
  18.     protected void onCreate(Bundle savedInstanceState) {
  19.         super.onCreate(savedInstanceState);
  20.         setContentView(R.layout.activity_main);
  21.  
  22.         getSupportActionBar().setTitle("Contoh VideoView");
  23.         getSupportActionBar().setSubtitle("Belajar di okedroid.com");
  24.  
  25.         videoView = (VideoView) findViewById(R.id.videoView);
  26.         //inisialisasi object videoView
  27.         videoView.setVideoPath("http://techslides.com/demos/sample-videos/small.mp4");
  28.         //digunakan untuk mengidentifikasi resource alamat url video
  29.         videoView.setMediaController(new MediaController(this));
  30.         //menampilkan media controller video
  31.         videoView.start();
  32.         //memulai video
  33.  
  34.  
  35.     }
  36. }
RAW Paste Data