I am downloading some of the images from server to sd card in a folder. Images are storing in sd card successfully. But the problem is that at the same time images are not showing in gallery. If i restart the device then it will be showing in gallery.
How can I refresh the gallery programmatically so images can be visible simultaneously whenever I fetch images from server?
I got it, below code will scan your image file and make it available simultaneously to gallery also:
MediaScannerConnection.scanFile(context,
new String[] { file.toString() }, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.i("ExternalStorage", "Scanned " + path + ":");
Log.i("ExternalStorage", "-> uri=" + uri);
}
});