0
    private void takeNewPicture() {  

    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);  

    ContentValues values = new ContentValues(3);  

    values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");  
    cameraImagePath = getContentResolver().insert(  
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);      
    //  cameraImagePath=  cameraImagePath+"/temp";  
    takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraImagePath);  
    startActivityForResult(takePictureIntent, 1);  
}  

我使用上面的代码来捕获和保存图像。但我需要更改保存文件的路径(在 SD 卡中)。

4

1 回答 1

0

利用:

//SD card "root" directory
File path = Environment.getExternalStorageDirectory();

或者

//SD card directory for pictures
File path = Environment.getExternalStoragePublicDirectory(
        Environment.DIRECTORY_PICTURES);
于 2013-07-18T16:59:21.153 回答