I
I
IA-NE-ROBOT2019-09-03 14:50:41
Android
IA-NE-ROBOT, 2019-09-03 14:50:41

How to load image from gallery in ImageView?

Everything seems to be simple:

var fname="/SD-карта/DCIM/Camera/20190805_135345.jpg"
var bitmap1=BitmapFactory.decodeFile(fname)
imageView2.setImageBitmap(bitmap1)

But it does not work - there is no picture. What could be the problem - the path is skewed or the code itself?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IA-NE-ROBOT, 2019-09-03
@IA-NE-ROBOT

Earned.
1. The path is incorrect, the correct paths are shown by third-party programs like Cx Explorer. Instead of "/SD-card/DCIM...." it is true "/storage/665A-C826/DCIM"....
2. You need to manually enable the memory permissions in the phone.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question