Luciano
Luciano

Reputation: 2798

image permissions (don't want them in gallery)

I'm working on a application which stores its images in the Android/data folder. The pictures are visible in the gallery, but I don't want that.

Is it possible to set permissions on a folder so they can only be used by the application itself, or should I just store them in another folder?

Upvotes: 2

Views: 396

Answers (1)

Michell Bak
Michell Bak

Reputation: 13242

Create a file called .nomedia in the folder. That'll hide them from the gallery application.

Here's how to do it in Java code:

File nomedia = new File(dataFolder, ".nomedia");
try {
    nomedia.createNewFile();
} catch (IOException e) {
    e.printStackTrace();
}

Upvotes: 7

Related Questions