Chris B
08/14/2024, 4:17 AMgetResources()
to load them, but I don't know how to get a reference to the Context
in order to do that.hafiz
08/14/2024, 6:45 AMcompose.resources {
publicResClass = true
packageOfResClass = "sample.io.library.resources"
generateResClass = always
}
add this in build.gradle then in class multiplatform can use like this:
Res.drawable.sample_image_nameChris B
08/14/2024, 7:45 AMChris B
08/14/2024, 7:46 AMhafiz
08/14/2024, 8:21 AMhafiz
08/14/2024, 8:22 AMclass DrawableResource
@InternalResourceApi constructor(id: String, items: Set<ResourceItem>) : Resource(id, items)
Chris B
08/14/2024, 9:35 AMContext
to get a resource?CLOVIS
08/14/2024, 9:39 AMI've got a number of images in the resources folder, but I won't know how many there are until runtime.You should clarify what you're doing, here. Usually, the resources folder is bundled into the binary (JAR…) at compile-time. So, there is no way to add resources between compile-time and run-time, unless the user unpackages the binary, updates the resources, and repackages them. What is the reason you can't know until run-time?
Chris B
08/14/2024, 9:40 AMChris B
08/14/2024, 9:41 AMChris B
08/14/2024, 9:42 AMCLOVIS
08/14/2024, 9:45 AMChris B
08/14/2024, 9:47 AMCaleb Kiage
08/14/2024, 11:29 AMChris B
08/14/2024, 11:31 AMChris B
08/14/2024, 11:31 AMCaleb Kiage
08/14/2024, 11:36 AMChris B
08/14/2024, 11:36 AMChris B
08/14/2024, 11:37 AMChris B
08/14/2024, 11:38 AMCaleb Kiage
08/14/2024, 11:42 AMCaleb Kiage
08/14/2024, 11:43 AMChris B
08/14/2024, 11:43 AMChris B
08/14/2024, 11:43 AMgetBytes()
on the text side and that's working well.Caleb Kiage
08/14/2024, 11:45 AMChris B
08/14/2024, 11:50 AMBitmapDrawable
require a Resources
object. The others are deprecated.Caleb Kiage
08/14/2024, 12:01 PMCaleb Kiage
08/14/2024, 12:02 PMChris B
08/14/2024, 12:02 PMCaleb Kiage
08/14/2024, 12:04 PMCaleb Kiage
08/14/2024, 12:04 PMChris B
08/14/2024, 12:05 PMCaleb Kiage
08/14/2024, 12:05 PMCaleb Kiage
08/14/2024, 12:06 PMCaleb Kiage
08/14/2024, 12:07 PMCaleb Kiage
08/14/2024, 12:07 PMChris B
08/14/2024, 12:09 PMChris B
08/14/2024, 12:12 PMRes.drawable.x
isn't seeing the x.png
file I've got sitting in the resources directory.Chris B
08/14/2024, 12:13 PMRes.drawable.foo
still exists, even though I deleted it an hour ago.hafiz
08/15/2024, 1:38 AMhafiz
08/15/2024, 1:42 AM