简体   繁体   English

Android:EXTERNAL_CONTENT_URI足够用于照片库吗?

[英]Android: Is EXTERNAL_CONTENT_URI enough for a photo gallery?

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 . 我正在玩Android的MediaStore类,当我注意到两个图像内容URI: EXTERNAL_CONTENT_URIINTERNAL_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. 起初我以为它是指存储的位置(外部SD或内部存储器),但经过一些测试后,情况显然并非如此。 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. 在这里阅读了更多关于它的内容,它似乎表明内部内容uri实际上是设备上每个应用程序内部的内容。 However I am not entirely sure and wanted opinions from more experienced developers who are more familiar with the MediaStore classes. 但是,我并不完全确定并希望更熟悉MediaStore类的更有经验的开发人员提出意见。

So my main question is, would just querying the EXTERNAL_CONTENT_URI be enough to get all of the important photos? 所以我的主要问题是,只是查询EXTERNAL_CONTENT_URI足以获得所有重要照片吗? And if possible to answer, what exactly is the INTERNAL_CONTENT_URI and what is it supposed to be used for? 如果有可能回答, INTERNAL_CONTENT_URI究竟是什么以及它应该用于什么?

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." 每个应用程序都可以读取外部存储空间,这是当您将手机插入计算机时出现的内容,因此您可以将其视为向其他人显示的内容,因此是“外部存储”。

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. 我有一个三星S5,它把内部和外部存储放在同一个“内部”闪存上,它们实际上只是同一个ram上的独立分区。

When I add a SD card, it adds another (secondary) external storage location. 当我添加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. 每个Android设备都必须附带内部和外部存储,因此保证没有SD卡的设备可以为内部和外部存储分配“内部”内存。

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. 至于External_Content_URI如何关联,它将返回位于外部存储中的图像 - 更密切地读取文档,它表示仅返回“主”外部存储卷。 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 http://developer.android.com/reference/android/provider/MediaStore.Images.Media.html

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

相关问题 Android中EXTERNAL_CONTENT_URI的文件路径 - Filepath of EXTERNAL_CONTENT_URI in Android 使用EXTERNAL_CONTENT_URI从图库中选择的图像中缺少EXIF信息 - Missing EXIF info in images selected from gallery using EXTERNAL_CONTENT_URI EXTERNAL_CONTENT_URI和INTERNAL_CONTENT_URI都从Android的内部存储卡中提取视频 - EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI both fetch videos from internal memory card in android 播放列表不是使用contentresolver在EXTERNAL_CONTENT_URI上创建的 - playlist is not created on EXTERNAL_CONTENT_URI using contentresolver 查询 MediaStore.Images.Media ,如何同时查询 EXTERNAL_CONTENT_URI 和 INTERNAL_CONTENT_URI? - Querying MediaStore.Images.Media , how do I query both on EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI? Android:从图库中获取照片始终返回位图而不是uri - Android : Get photo from gallery always returns bitmap not uri Android Photo Gallery无法从OnActivityResult中的数据返回正确的Uri - Android Photo Gallery does not return correct Uri from data in OnActivityResult Android:将照片保存到照片库中 - Android: Save a photo into photo gallery Android画廊的照片显示 - Photo display for Android gallery Android照相馆 - Android photo gallery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM