Can you load a drawable from a sub directory in the assets
(not the drawable folder) folder?
Yes you can create a Drawable
object from an InputStream
using the createFromStream() method.
I was working in a RecyclerView adapter and found that David's answer was not working for me, (for some reason asset.open
remained Unresolved no matter what I imported )
so I found this to work for me (Kotlin code)
val d = Drawable.createFromStream(context?.assets?.open("imageData/${imageName}.png"), null)
here is my directory, as you can see the assets start from the assets folder and here is a link on how to create that assets folder