I have a problem with the following code in Android Studio:
try {
FileInputStream fileInputStream = new FileInputStream(dirPhoto);
bitmap = BitmapFactory.decodeStream(fileInputStream);
vwImagen.setImageBitmap(bitmap);
} catch (SecurityException io) {
} catch (FileNotFoundException io) {
}
The fileInputStream was found, but method BitmapFactory.decodeStream(fileInputStream)
return a null.
dirPhoto=/data/data/com.example.leandro.application/files/pic_20170316104409.jpg
The problem was that for some reason FileInputStream could not decode the address contained in dirPhoto (even if it existed). I solved it by creating the address with the method: "myContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath()"
Thank you very much!