ad728

Monday, April 10, 2017

AIDE Tutorial - 32 Video View

AIDE Tutorial - 32 Video View






Main xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center">
    <VideoView
        android:id="@+id/video"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>
Java


package com.kc.videoview;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.net.*;
public class MainActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);




VideoView video=(VideoView)findViewById(R.id.video);
video.setVideoURI(Uri.parse("android.resource://"
+getPackageName() + "/" +R.raw.video));

video.setMediaController(new MediaController(this));
video.requestFocus();
    }
}


Share:

0 comments:

Post a Comment

Total Pageviews

Sponsor

Sponsor

ad300