开发者

What happens to cursors to MediaStore when the underlying database gets updated?

开发者 https://www.devze.com 2023-03-27 19:47 出处:网络
In my app (a small mp3-player for an university project) I\'m doing query MediaStore.Audio.Media.EXTERNAL_CONTENT_URI. Currently, I\'m caching the songs to an array, but I\'m thinking of moving it ove

In my app (a small mp3-player for an university project) I'm doing query MediaStore.Audio.Media.EXTERNAL_CONTENT_URI. Currently, I'm caching the songs to an array, but I'm thinking of moving it over to just using the Cursor object.

I can see a few problems:

  1. The underlying database can get updated (the Android device detected a song getting added or removed)
  2. A song gets removed without the database ge开发者_高级运维tting updated.

For the first point:

  • what happens to the cursor when the database gets updated?
  • How can I detect when MediaStore gets updated?

For the second point:

  • Is the only thing I can do to detect this to try to access the resource and see whether it fails?
0

精彩评论

暂无评论...
验证码 换一张
取 消