I am trying to load image from network using Coil accompanist library. I am getting frame drops due to the same.
I/Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread.
Is there a way to load images in background thread? Here is my code :
val painter = rememberCoilPainter(request = url)
Card(modifier = modifier) {
when (painter.loadState) {
is ImageLoadState.Success ->
Image(
painter = painter,
contentDescription = title,
contentScale = ContentScale.FillBounds
)
else ->
Image(
painter = rememberCoilPainter(request = R.drawable.placeholder),
contentDescription = title,
contentScale = ContentScale.FillBounds
)
}
}
This code is the content part of LazyRow and there are around 20-25 items in the list.
Please suggest a way to perform the image loading in background thread to avoid frame drops.