I'm trying to save an image file to external storage. I can save the picture to the sdcard but it doesn't show up in Androids gallery application. I've tried this approach:
File path = Environment.getExternalStorageDirectory();
File f = new File(path + "/mydirectory/" + imageName + "_" + System.currentTimeMillis() + ".jpg");
FileOutputStream fos = new FileOutputStream(f);
f.mkdirs();
b.compress(CompressFormat.JPEG, 100, fos);
fos.close();
Uri contentUri = Uri.fromFile(f);
Intent mediaScanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE");
mediaScanIntent.setData(contentUri);
getApplicationContext().sendBroadcast(mediaScanIntent);
But it doesn't show up in the gallery. Can anyone point me in the right direction to solve this problem?
Use this code to save an image Bitmap in android device gallery
Here i am saving the image in " Rotate " folder if you dont want that you can change it easily in savePhoto method.