如何在sd card中保存文件,在camera 类中创建了一个图片,然后创建一个新的目录来保存它。它创建了文件夹,但这个图片为什么不在文件夹中?
if (items[which].equals("Picture")) {
Intent cameraIntent = new Intent(
MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent,
PICTURE_ACTIVITY);
File imagesFolder = new File(Environment
.getExternalStorageDirectory(),
"SeccyPhotos");
imagesFolder.mkdirs(); // <----
File image = new File(imagesFolder, "image_001.jpg");
Uri uriSavedImage = Uri.fromFile(image);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
uriSavedImage);
}
我调用了camera类,这样的话之后拍摄的照片就应该保存在文件夹中。
请问下:视频和照相机相同吗?
Intent cameraIntent = new Intent(
MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(cameraIntent,
PICTURE_ACTIVITY);
File videosFolder = new File(Environment
.getExternalStorageDirectory(),
"cangryVideos");
videosFolder.mkdirs(); // <----
File video = new File(videosFolder, "Video_001.3gp");
Uri uriSavedvideo = Uri.fromFile(video);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,
uriSavedvideo);
startActivityForResult(cameraIntent,
PICTURE_ACTIVITY);