Im adding images to a folder on the SDCARD. Since the images and my folder is not immediately visible in the Gallery im trying to get the MediaScannerConnection to update an
Use Intent
instead of MediaScannerConnection
. MediaScannerConnection
will make your app gc error with IMediaScannerListener.Stub mListener
.
Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
Uri fileContentUri = Uri.parseFile(permFile); // With 'permFile' being the File object
mediaScannerIntent.setData(fileContentUri);
sendBroadcast(mediaScannerIntent);