I am trying to fetch image from url using Coil Image Loader but it is not working.
I tried the code on Coil's own site, but it didn't work.
First I get the drawable with the code block below.
val request = ImageRequest.Builder(context)
.data(url)
.memoryCachePolicy(CachePolicy.ENABLED)
.error(R.drawable.error_image)
.target { drawable ->
callback(drawable)
}
.build()
val disposable = ImageLoader(context)
disposable.enqueue(request)
Then I pass it to "Image" in the code block below. But the picture does not come, an empty pink color comes out. I checked the url, the error is not from him. Drawable does not come empty, it takes data. Even the data is the same as the image dimensions in the url. But I couldn't solve the problem.
Image(
painter = rememberAsyncImagePainter(drawable),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = modifier
)