VideoView
16lz
2021-01-26
package com.videoview;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
import android.annotation.SuppressLint;
import android.app.Activity;
public class MainActivity extends Activity {
private VideoView video;
@SuppressLint("SdCardPath")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
video=(VideoView) findViewById(R.id.video);
//访问SD卡上的资源
video.setVideoURI(Uri.parse("/mnt/sdcard/weibo.mp4"));
MediaController mc=new MediaController(this);
video.setMediaController(mc);
video.start();
}
}
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
import android.annotation.SuppressLint;
import android.app.Activity;
public class MainActivity extends Activity {
private VideoView video;
@SuppressLint("SdCardPath")
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
video=(VideoView) findViewById(R.id.video);
//访问SD卡上的资源
video.setVideoURI(Uri.parse("/mnt/sdcard/weibo.mp4"));
MediaController mc=new MediaController(this);
video.setMediaController(mc);
video.start();
}
}
更多相关文章
- android中用到的资源Color
- 安卓即使增加了权限也不可以访问网络
- ToolBar基本使用及自定义ToolBar
- android values 资源说明
- Android(安卓)每周必看资源
- Android(安卓)Content Provider基础
- Android遇到的错误记录
- 谈谈Android的三种网络通信方式
- android动态加载外部资源文件