YASAN
04/20/2021, 7:39 PMcoroutines
in a LazyVerticalGrid
item. I have this:
val coroutineScope = rememberCoroutineScope()
and this in a `Column`:
val drawable = mutableStateOf<Drawable?>(null)
coroutineScope.launch {
drawable.value = app.requireIcon(activity)
}
But the code inside launch
does not even start. What am I doing wrong?
I need to load a Drawable inside each lazy item and it can take a few seconds so I cannot do it on the main thread.Alexander Karkossa
04/20/2021, 7:52 PMYASAN
04/20/2021, 7:54 PMYASAN
04/20/2021, 7:57 PMsteelahhh
04/20/2021, 8:36 PMsteelahhh
04/20/2021, 8:37 PMremember
the drawable because without it, it will reset after recomposition, so do this:
var drawable by remember { mutableStateOf<Drawable?>(null) }
YASAN
04/20/2021, 9:15 PMYASAN
04/20/2021, 9:15 PM