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卡中)。
答案 0 :(得分:0)
使用:
//SD card "root" directory
File path = Environment.getExternalStorageDirectory();
或
//SD card directory for pictures
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);