I hope this code help u
public class video extends Activity{
VideoView video_view;
String ex_name;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.eccryption);
video_view = (VideoView) findViewById(R.id.videoView1);
ex_name = getIntent().getExtras().getString("video_name");
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(video_view);
video_view.setMediaController(new MediaController(this));
handler.sendEmptyMessage(1);
}
Handler handler = new Handler(){
public void handleMessage(Message msg){
int pos=msg.what;
if (pos == 1){
video_view.setVideoPath(Environment.getExternalStorageDirectory()+"/"+ex_name+".mp4");
video_view.requestFocus();
video_view.start();
Log.d("Before Video Finish", "i m in before video finish");
video_view.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
finish();
}
});
}
}
};
Use this Code This Code,My dear friends !
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…