I’m building a Camera application and after taking a picture(after writing to a file in the PictureCallback), I want to update the media files on the device and so I use MediaScannerConnection(as in the following code). But, I’m not able to view the images in the gallery application on the device. However I can view the images on the PC(The images are on the SD card). Am I missing anything?
MediaScannerConnection.scanFile(this,
new String[] {pictureFile.toString()}, null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Log.d("ExternalStorage", "Scanned " + path + ":");
Log.d("ExternalStorage", "-> uri=" + uri);
}
});
I think the following might be helpful (from the android-developers mailing list archive):