I'm loading a cursor from MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI
, into a cursor loader, which is shown in a gridview (using a cursor adapter). When a new photo is taken, while my app is running, I want the loader and gridview to automatically and immediately update (show the new thumbnails). I believe other gallery apps do this... at least the default gallery app. It's an obvious feature?
I've tried to simply restart my loader, but the UI doesn't show the new images. However, if I switch into another gallery app and back to mine, the new images appear. I assume this is because switching apps like this really means restarting my app.
How can I/should I trigger an automatic reload in my app? If I can't trigger automatically (when a new image is added), I could maybe have a refresh menu-option. All this is mainly to learn how to refresh the MediaStore, if that makes sense to say and if that's even possible for third-party apps...
I've seen references to using a MediaScanner, but these always assume it is my app that had edited/inserted/deleted an image, so I can reload with a specific file location/path. However, my app is only showing (all) images/thumbs, so I don't know anything about any new image.