调用系统录像功能保存文件到sdcard

    public void click(View view) throws Exception {
        Intent intent = new Intent();
        intent.setAction("android.media.action.VIDEO_CAPTURE");
        intent.addCategory("android.intent.category.DEFAULT");
        String fileName = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date())+".3gp";
        System.out.println(fileName);
        File file = new File("/sdcard/"+fileName);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
        startActivity(intent);
    }
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
    <!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
    <!--<uses-feature android:name="android.hardware.camera"/>-->

 照相机有保存文件的权限

posted @ 2015-11-04 16:01  一路向北中  阅读(225)  评论(0)    收藏  举报