I'm using Jetpack Compose in an Android app. I need to load images and I use:
Image(
modifier = centerHorizontal
.size(AppSize.profileImage)
.border(
width = AppSize.line,
color = Color.White,
shape = AppCircleShape()
),
painter = rememberImagePainter(
data = profile.image,
builder = {
transformations(CircleCropTransformation())
}
),
contentDescription = stringResource(id = R.string.profile_image)
)
It works fine.
Now I need to load local images that I have downloaded using the DownloadManager.
The download manager is set up to download the images in the Download folder. They end being in the folder /storage/emulated/0/Download. I verified that the images are there.
The problem is that I don't know how to show them. Do I have to run a local web server to expose them?
I tried to use "file://${user.profile}", that works on Chrome, but it doesn't work.
CodePudding user response:
If you have a file path, try to transfer the file,please try
val path = ...
Image(rememberImagePainter(File(path)),
contentDescription = ""
)
