I have some doubts on the reliability of content providers in Android.
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
and
content://com.android.providers.media.documents/document/image%BBBBB
Supposing a scenario where AAAAA
would point to a file, then the user erases that file.
User then creates a new file in the system, and that new file receives the AAAAA
Uri.
Can this scenario happen?
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)?
Yes.
Yes.
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.