ad728

Saturday, February 20, 2021

AIDE Tutorial - 32 VideoView


Main xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <VideoView
        android:id="@+id/videoView"
        android:layout_width="match_parent"
      android:layout_height="match_parent"
       />
</LinearLayout>
Java
package com.mycompany.myapp5;
import android.app.*;
import android.os.*;
import android.widget.*;
import android.net.*;
import org.apache.http.client.protocol.*;
public class MainActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
   

VideoView video=(VideoView)findViewById(R.id.videoView);
video.setVideoURI(Uri.parse("android.resource://"+ getPackageName() + "/" + R.raw.customlayout));
video.setMediaController(new MediaController(this));
video.requestFocus();



}
}
Share:

Total Pageviews

Sponsor

Sponsor

ad300