Android 内部和外部存储
我有一个可以访问音乐的应用程序,至少有一个用户抱怨他的一些歌曲位于内部存储中,这导致了强制关闭。
我的问题是,我现在是否必须为每首歌曲执行 2 次调用,或者我可以进行查询来查看内部和外部存储器吗?
I have an app that accesses music and I had at least one user complain that some of his songs are on internal storage and that causes a force close.
My question is do I have to do 2 calls for each song now or can I make a query that will look at both the internal and external memory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
多媒体不是我的强项,但我认为媒体扫描仪会保留内容索引。另一种选择是查看启动时媒体文件所在的位置,并将这些数据记录在 SharedPreferences 中以供以后使用。
Multimedia is not my strong suit, but I would think the media scanner would keep an index of what is where. Another option would be to look at startup where the media files are located and record this data in
SharedPreferences
for later use.看看我在这篇文章中的回答:
https://stackoverflow.com/a/13935210/1716620
关键
ContentProvider 是我有一个使用外部和内部的应用程序的 内存来保存图片,我需要使用图库在某些情况下查看它们,如果我尝试传递指向内部内存的 uri
https://stackoverflow.com/a/13935210/1716620
这样我解决了我的问题......还有你的:)
look at my answer in this post:
https://stackoverflow.com/a/13935210/1716620
ContentProvider is the key
i have an application that use external and internal memory to save pictures and i needed to use gallery to view them in some rircumstance and it gave error if i tried to pass an uri that pointed to an internal memory
https://stackoverflow.com/a/13935210/1716620
that way i solved my problem... and your :)
这取决于制造商如何实施其 MediaProvider/Scanner 等,因为没有针对多个闪存 (SD) 设备的标准。
It depends on how the manufacturer implemented their MediaProvider/Scanner etc. as there is no standard for more than one flash(SD) device.