image - Android Studio - Unable to decode stream (Permission denied) -


i have method show 1 image sd card 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 imageview, , path correct one. i'm getting messages:

e/bitmapfactory: unable decode stream: java.io.filenotfoundexception: /storage/2673-1d16/profilephotos/foto.jpg: open failed: eacces (permission denied) i/image: image exists! 

and androidmanifest.xml have permissions:

  • "android.permission.read_external_storage"
  • "android.permission.write_external_storage"

i have been looking answer, no 1 works me. idea?

thanks in advance.

you have check permission on runtime. it´s new in android 6. look here.


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -