I think you are already deleting the file after creating it and then you are trying to convert the non-exists file into the bitmap which is not valid. That is why you are getting an error no such file or directory found.
Just remove the line file.delete();
from your code and try out.
6
solved Saving bitmap from fragment to internal/external storage [closed]