After Saved Image Can't See It In Gallery Android
I am saving Image from res/drawable to Gallery using InputStream and OutputStream. It works fine and save image. But issue is that It does not update Image in Gallery. If I check f
Solution 1:
you must broadcast external directory...
sendBroadcast(newIntent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.parse("file://" + Environment.getExternalStorageDirectory())));
if you create external folder in sdcard and then its not display in gallary then use below code.
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
Runtime.getRuntime().exec(
"am broadcast -a android.intent.action.MEDIA_MOUNTED -d file://"
+ CommonVariable.abc_FOLDER);
} else {
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
Uri.parse("file://" + CommonVariable.abc_FOLDER)));
}
other method for scanning.
UricontentUri= Uri.fromFile(destFile);
IntentmediaScanIntent=newIntent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(contentUri);
sendBroadcast(mediaScanIntent);
i hope its useful to you.
Post a Comment for "After Saved Image Can't See It In Gallery Android"