user7243022
user7243022

Reputation:

how to load image from path into image view?

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)

Upvotes: 0

Views: 906

Answers (1)

ghasem deh
ghasem deh

Reputation: 718

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

Upvotes: 1

Related Questions