I have this method for show one image from my SD card to Android studio:
public void showImage(){
File imgFile = new File(Environment.getExternalStorageDirectory().getPath()+PATH+"Foto.jpg");
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ivProfileImage.setImageBitmap(myBitmap);
Log.i("Image","The image exists!");
}
}
Where ivProfileImage is an ImageView, and PATH is a correct one. I'm getting this messages:
E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/2673-1D16/ProfilePhotos/Foto.jpg: open failed: EACCES (Permission denied)
I/Image: The image exists!
And my AndroidManifest.xml have the permissions:
I have been looking for an answer, but no one works for me. Any idea?
Thanks in advance.
You have to check for permission on runtime. It´s new in Android 6. Look here.