Uri on Activity.onActivityResult(int requestCode,int resultCode,Intent数据) [英] Uri on Activity.onActivityResult(int requestCode, int resultCode, Intent data)
问题描述
我对Android内容提供商的可靠性有些怀疑.
I have some doubts on the reliability of content providers in Android.
1-例如,不同的Document
是否可能具有相同的Uri?
用户在设备中有2张图片:
1 - Is it possible for different Document
s having the same Uri?
For instance. A user has 2 images in the device:
content://com.android.providers.media.documents/document/image%AAAAA
和
content://com.android.providers.media.documents/document/image%BBBBB
假设AAAAA
指向文件,然后用户删除该文件.
Supposing a scenario where AAAAA
would point to a file, then the user erases that file.
用户在系统中创建一个新文件,该新文件将收到AAAAA
Uri.
这种情况会发生吗?
User then creates a new file in the system, and that new file receives the AAAAA
Uri.
Can this scenario happen?
还是按顺序生成它们,以便首先创建CCCCC
DDDDD
等.我可以相信Uri始终指向同一文件实例(如果找不到该文件,则返回null友利)
2-Uri是否有可能指向已被重大更改的文档?
曾经是音频,现在是图像的文档是否具有与以前相同的标识符?我不是说用户已经更改了文件内容,而是一个隐式意图给了我一个Uri,我可以相信该设备中该文档的Uri是唯一的吗?Or are they sequentially generated so that CCCCC
DDDDD
etc.. gets created first, in a way that I can trust Uri's to always point to the same file instance (or null if no document can be found by that Uri)?
2 - Is it possible for an Uri pointing to a document that has been significantly altered?
Can a document, that once was Audio, and now is an Image, have the same identifier that once had? I do not mean that the user has changed the file content, but rather an implicit intent gave me a Uri, can I trust that Uri to be unique, for that document in that device?推荐答案
这种情况会发生吗?
Can this scenario happen?
是的
曾经是音频,现在是图像的文档,是否具有与以前相同的标识符?
Can a document, that once was Audio, and now is an Image, have the same identifier that once had?
是的
请注意,计算机中的几乎所有其他事物都适用相同的条件.例如,可以重复使用URL来指向不同的Web内容,包括具有不同MIME类型的内容.
Note that the same thing holds true for pretty much everything else in computers. For example, a URL can be reused to point to different Web content, including content with a different MIME type.
这篇关于Uri on Activity.onActivityResult(int requestCode,int resultCode,Intent数据)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!