I save an image to the sdcard and it doesn't appear in the Gallery application until I pull off the sdcard and return it back.
Do you have any idea why is it so?
Seems like the Gallery application has some cache that isn't updated on file save...
Actually, I also want to open the just-saved image in Gallery application and have no success with that
this is my question about this issue.
A simpler solution is to use the static convenience method scanFile():
where
this
is your activity (or whatever context), the mime-type is only necessary if you are using non-standard file extensions and thenull
is for the optional callback (which we don't need for such a simple case).Gallery refresh including Android KITKAT
Here is the code for the MediaScannerConnection:
newfile is the File object of your new/saved file.
Let your activity implement 'MediaScannerConnectionClient' and add this to your activity:
Does not seem to work on KITKAT. It throws permission denial exception and crashes the app. So for this, I have done the following,
Hope it helps.
this work with me