The following method returns a File, but I can not get it to be set in an imageView
public File SaveImage(Bitmap ImageToSave) {
String file_path = Environment.getExternalStorageDirectory()
.getAbsolutePath() + NameOfFolder;
String CurrentDateAndTime = getCurrentDateAndTime();
File dir = new File(file_path);
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, NameOfFile + CurrentDateAndTime + ".jpg");
try {
FileOutputStream fOut = new FileOutputStream(file);
ImageToSave.compress(Bitmap.CompressFormat.JPEG, 85, fOut);
fOut.flush();
fOut.close();
MakeSureFileWasCreatedThenMakeAvabile(file);
AbleToSave();
}
catch(FileNotFoundException e) {
UnableToSave();
}
catch(IOException e) {
UnableToSave();
}
//return file.getPath();
//return file.getAbsolutePath();
return file;
}
File file = saveImage(currentBitmap);
Picasso.get().load(file.getAbsolutePath()).into(imageView);
And I do not use the currentBitmap because it is to store a database.