-2

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?

Braiam
  • 1
  • 11
  • 47
  • 78
giroxasmnl
  • 131
  • 1
  • 3
  • 14

2 Answers2

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