Lumluk Wp
Lumluk Wp

Reputation: 45

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. 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

something like this. Hope you understand what I mean, Thanks.

Upvotes: 0

Views: 3550

Answers (2)

Jazz
Jazz

Reputation:

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

Upvotes: 2

Vincent Mimoun-Prat
Vincent Mimoun-Prat

Reputation: 28541

Just before saving your file, simply create all the directory structure, the mkdirs method will do the necessary work if necessary.

new File("/sdcard/photos/newfolder").mkdirs()

Upvotes: 1

Related Questions