图像的权限(不想他们在画廊) [英] image permissions (dont want them in gallery)

查看:109
本文介绍了图像的权限(不想他们在画廊)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序至极存储他的图像。
这些照片是在画廊看到,但我不希望出现这种情况。

I'm working on a application wich stores his images in the Android/data folder. The pictures are visible in the gallery but i dont want that.

是否可以对文件夹设置权限,使他们只能通过应用它的自我使用,或者我应该只是把它们存储在一个文件夹中的其他?

Is it possible to set permissions on a folder so they can only be used by the application it self or should i just store them in a other folder?

推荐答案

创建一个名为 .nomedia 文件夹中的文件。这会从库应用程序隐藏起来。

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

下面是如何做到这一点在Java中code:

Here's how to do it in Java code:

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

这篇关于图像的权限(不想他们在画廊)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆