Android-MediaStore ID是存储有关图片/相册信息的安全方法吗? [英] Android - Is MediaStore ID a safe way to store information about pics/albums?

查看:292
本文介绍了Android-MediaStore ID是存储有关图片/相册信息的安全方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我通过存储媒体图片ID来存储有关图片或相册的信息。稍后,我可能必须执行需要这些图像/相册的操作。 MediaStore ID是保存图像专辑信息的安全方法吗?
更具体地说:

In my app I store information about an image or an image album by storing it's MediaStore id. Later on I may have to perform operations that require these images/albums. Is the MediaStore id a safe way to keep image\album information? More specifically:

1)如果删除了我存储的ID的图像/专辑,是否有可能使用新的图片/专辑作为ID在我使用错误的图片/相册吗?

1) If an image/album whose id I have stored gets deleted, is it possible a new picture/album could take this id resulting in me using the wrong picture/album ?

2)当图片/相册被重命名或移动时(使用手机上的文件浏览器或通过连接到笔记本电脑)他们的ID更改了?

2) when pictures/abums are renamed or moved ( using a file browser on the phone or by connecting to a laptop) do their ids change ?

如果是的话...我应该采取什么措施避免这些错误?

If so...what measures do I take to avoid these errors ?

推荐答案

我对此没有直接的经验,但是出现在此SE答案,即当用户移动单个ID时,它们确实会更改,并且如果SD媒体已断开连接并重新连接,则所有ID都可能会更改。

I've not had direct experience with this, but appears from this SE answer that individual IDs do change when the user moves them, and all IDs may change if the SD media is disconnected and reconnected.

似乎更好地存储了自己的唯一ID( p可能是通过创建哈希值),或更简单地说是创建文件名。

Better, it seems, to store your own unique ID (perhaps by creating a hash value), or, more simply, the filename.

这篇关于Android-MediaStore ID是存储有关图片/相册信息的安全方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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