Trying to do this code
try {
if(!file.exists()){
file.createNewFile()
file.exists()
}
val out = FileOutputStream(file)
finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out)
out.flush()
out.close()
} catch (e: Exception) {
e.printStackTrace()
}
But getting
java.io.IOException: No such file or directory
Very strange behaviour