after creating a directory in:
/storage/emulated/0/Pictures/ViralFindrr
and saving a bitmap in that directory, the directory and file get created, but it doesn't show up as album in my gallery. Did I miss something?
Here is my code:
private void createDirectoryAndSaveFile(ImageView imageView, String fileName) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) imageView.getDrawable();
Bitmap bitmap = bitmapDrawable.getBitmap();
File dir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES)+ "/ViralFindrr/");
if(!dir.exists())
dir.mkdir();
File file = new File(dir,System.currentTimeMillis()+".jpg");
if (file.exists()) {
file.delete();
}
try {
FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG,100,out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
I am testing the code on my android device.