Android:EXTERNAL_CONTENT_URI是否足以容纳照片库? [英] Android: Is EXTERNAL_CONTENT_URI enough for a photo gallery?

查看:166
本文介绍了Android:EXTERNAL_CONTENT_URI是否足以容纳照片库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在玩Android的 MediaStore 类,并且当我发现有两个图像内容URI: EXTERNAL_CONTENT_URI 和<代码> INTERNAL_CONTENT_URI .起初我以为是指存储位置(外部SD或内部存储器),但经过一些测试,显然不是这种情况.我在此处了解了更多信息,而且似乎表示内部内容uri实际上是设备上每个应用程序内部的内容.但是,我不太确定,也想从更熟悉 MediaStore 类的经验丰富的开发人员那里征求意见.

I'm playing around with Android's MediaStore classes and was attempting to create a very simple photo gallery app when I noticed that were two image content URIs: EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI. At first I thought it was referring to the location of storage (external SD or internal memory) but after a bit of testing this was clearly not the case. I read more about it here, and it seemed to indicate that the internal content uri is actually content that are internal to each of the apps on the device. However I am not entirely sure and wanted opinions from more experienced developers who are more familiar with the MediaStore classes.

所以我的主要问题是,仅查询 EXTERNAL_CONTENT_URI 就足以获取所有重要照片吗?如果可能的话, INTERNAL_CONTENT_URI 的确切含义是什么?

So my main question is, would just querying the EXTERNAL_CONTENT_URI be enough to get all of the important photos? And if possible to answer, what exactly is the INTERNAL_CONTENT_URI and what is it supposed to be used for?

推荐答案

外部存储与内部存储不是指内存的位置,而是与之相关的隐私权政策.内部存储意味着只有应用程序或系统/超级用户进程才能访问内容.

External vs Internal storage doesn't refer to the location of the memory, but the privacy policy regarding it. Internal storage means only the app or system/super user processes can access the contents.

每个应用都可以读取外部存储,当您将手机插入计算机时,外部存储便会显示该外部存储,因此您可以将其视为显示给其他所有人的内容,因此是外部".

External storage can be read by every app, it's what appears when you plug in your phone to your computer, so you can think of it as what is shown to everyone else, hence "external."

例如,我有一个三星S5,它将内部和外部存储都放在同一内部"闪存中,实际上它们只是同一根ram上的单独分区.

I have a Samsung S5 for instance, and it puts both internal and external storage on the same 'internal' flash memory, they are in fact just separate partitions on the same stick of ram.

当我添加SD卡时,它会添加另一个(辅助)外部存储位置.

When I add a SD card, it adds another (secondary) external storage location.

每个android设备都必须带有内部和外部存储,因此,保证没有SD卡的设备都具有用于内部和外部存储的分区内部"内存.

Every android device must ship with internal and external storage, so devices that ship without an SD Card for instance are guaranteed to have partitioned 'internal' memory, for internal and external storage.

关于External_Content_URI的关系,它将返回位于外部存储中的图像-更仔细地阅读文档,它说它仅针对主"外部存储卷返回.我只是注意到最后一部分引用了我自己,所以如果在第二天外部媒体也对二级外部存储也进行了索引或检索,并且如果有人没有帮助首先对它进行回答,我将在接下来的几天中对此进行测试.

As for how the External_Content_URI relates, it will return images that are located in external storage -- reading the docs more closely, it says it returns only for the "primary" external storage volume. I just noticed that last part in quotes myself, so it's something I'll test in the next few days if secondary external storage is also indexed or retrieved by the mediastore, if someone else doesn't help answer that first.

http://developer.android.com/reference/android/provider/MediaStore.Images.Media.html

这篇关于Android:EXTERNAL_CONTENT_URI是否足以容纳照片库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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