0

i storage image path (image from gallery) in SQLite database and now load into image view ... and use this code :

File imgFile = new File(cursor.getString(cursor.getColumnIndex("pic")));
                if (imgFile.exists()) {
                    IMG_USER.setImageBitmap(BitmapFactory.decodeFile(cursor.getString(cursor.getColumnIndex("pic"))));
                } else { Toast.makeText(this, "عکس پیدا نشد", Toast.LENGTH_LONG); }

and error :

E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20161230_224205.jpg (Permission denied)

  • 1
    Did you allow permission to storage at runtime? https://developer.android.com/training/permissions/requesting.html – Alexander N. Dec 30 '16 at 19:25

1 Answers1

1

you are need access permission , add this code into android manifest

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

or try this

Exception 'open failed: EACCES (Permission denied)' on Android

Community
  • 1
  • 1
ghasem deh
  • 698
  • 1
  • 10
  • 26