I am currently creating a camera app and storing it. However, every time I take a picture, the picture is saved in the directory but is not saved in the Gallery. I think it's all about the generation of thumbnail right after the image has been taken. How can you generate a thumbnail in the gallery?
Asked
Active
Viewed 715 times
-2
-
possible duplicate http://stackoverflow.com/questions/19558188/photo-does-not-show-up-to-gallery – denis_lor Nov 04 '15 at 11:27
2 Answers
1
Try this:
Intent mediaScan = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScan.setData(uri);
context.sendBroadcast(mediaScan);

riu999
- 46
- 4
0
If you are adding files or images programmatically, you have to use MediaScannerClass to scan the media file for your sd card.
of you can also use following piece of code:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://"+ Environment.getExternalStorageDirectory())));

Er.Rohit Sharma
- 696
- 5
- 21