这是主要活动的原始代码,当我启动应用程序并单击reocrd_video按钮时,它说不幸的是应用已停止。
我添加了启动默认硬件摄像头的简单意图
private void video_record (View v){
File Video_file = getFile();
Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
Uri uri = Uri.fromFile(Video_file);
startActivityForResult(i,result_code);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode==result_code){
if(resultCode==RESULT_OK){
Toast.makeText(getApplicationContext(),"Video saved",Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(getApplicationContext(),"Error has occured",Toast.LENGTH_LONG).show();
}
}
super.onActivityResult(requestCode, resultCode, data);
}
private File getFile(){
File Folder = new File("/storage/sdcard1/mycamera");
if(!Folder.exists()){
Folder.mkdir();
}
File video_file = new File(Folder,"step1.mp4");
return video_file;
}
}
答案 0 :(得分:0)