I have a sandbox app I'm working on right now wher...
# compose-android
c
I have a sandbox app I'm working on right now where I just load up all of the apps on the users phone. Kinda like a fake launcher. So I show a grid of icons with the app name under it. I'm investigating where would be the best place to query for the app icon/get the drawable or bitmap. Currently I basically have a
viewModel.launch(<http://Dispatchers.IO|Dispatchers.IO>) that getsAllPackages.map { mapToAppIconAndName(it) }
The mapToAppIconAndName takes the packageinfo and gives me a dawable and a string for the icon and the name respectively. then in my lazy grid I take the drawable and call
Copy code
Image(
bitmap = it.drawable.toBitmap().asImageBitmap(),
I'm wondering if I should try to move the above to my viewmodel w/ background thread. or at that point would keeping 300+ image bitmaps in memory be bad?
FWIW, I'm trying to profile this but fighting with some studio profiler issues 😅 Figured I'd ask to just start a convo to see if there's a general feeling on the most logical route forward
b
Just use an image loading library and save yourself the headache. They support more than just URLs https://coil-kt.github.io/coil/getting_started/#supported-data-types
5
c
oooh. idk why i didn't think of that. lets see if getting the drawable in the viewModel on a dispatcher, then using coil gets the job done.