简体   繁体   English

从自定义相机应用程序拍照时如何创建新文件夹?

[英]How to create a new folder when taking a photo from custom camera application?

Right now, I finished with my custom camera application that will save the picture that I took into sdcard. 现在,我完成了我的自定义相机应用程序,该应用程序会将我拍摄的照片保存到sdcard中。 But I want to put these pictures in a folder which will be create when you took your first photo. 但是我想将这些图片放在您拍摄第一张照片时创建的文件夹中。

Working step: Start my application > took a photo > check for the folder to stored in > if sdcard already have that folder then stored the photo inside the folder but if it doesn't have a folder then create new one > stop 工作步骤:启动我的应用程序>拍照>检查要存储的文件夹> sdcard是否已经有该文件夹,然后将照片存储在该文件夹中,但是如果它没有文件夹,则创建一个新文件夹>停止

something like this. 这样的事情。 Hope you understand what I mean, Thanks. 希望你明白我的意思,谢谢。

File mFile=new File("/sdcard/photos/newfolder");
mFile.mkdir();

Just before saving your file, simply create all the directory structure, the mkdirs method will do the necessary work if necessary. 在保存文件之前,只需创建所有目录结构,mkdirs方法将在必要时完成必要的工作。

new File("/sdcard/photos/newfolder").mkdirs() 新File(“ / sdcard / photos / newfolder”)。mkdirs()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Android相机拍照后,如何根据需要自动将图像保存到特定文件夹或创建新文件夹 - How to save an image automatically to a specific folder or create a new folder if needed after taking a picture using the camera for android 从 Oneplus 中的相机拍照时应用程序在后台崩溃 - App crashing in background when taking photo from camera in Oneplus 如何从相机应用程序将照片上传到Facebook - How to upload photo to facebook from a camera application 照片在自定义相机应用程序中旋转 - Photo rotated in custom camera application 如何从相机拍摄照片并在Android应用程序中添加照片库? - How to take photo from camera and add photo gallery in android application? 通过从相机拍摄照片来裁剪图像 - crop image by taking photo from camera 从Android相机拍摄照片以更改2个ImageViews - Taking Photo from Android Camera to Change 2 ImageViews 如何在相机胶卷中创建新文件夹? - How to create a new folder in Camera roll? 从我的相机应用程序拍照后,图片无法保存到图库中 - Picture does not save to gallary after taking photo from the my camera application 如何在Android中使用自定义相机应用程序调用另一项有关拍照的活动? - How invoke another activity on taking a picture with custom Camera Application in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM