使用VideoView播放视频

package com.pingyijinren.test;

import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends AppCompatActivity{
    private VideoView videoView;

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

        videoView=(VideoView)findViewById(R.id.videoView);
        videoView.setVideoURI(Uri.parse("android.resource://com.pingyijinren.test/" + R.raw.lesson));
        videoView.setMediaController(new MediaController(this));
        videoView.start();
    }
}

 

posted @ 2016-05-18 14:50  zqxLonely  阅读(203)  评论(0编辑  收藏  举报