I wanted to create a custom AndroidImageAsset ```...
# compose
s
I wanted to create a custom AndroidImageAsset
Copy code
Image(asset = CustomAndroidImageAsset(bitmap = p.bitmap))
But some how when framework starting to draw the image. there is an implementation inside AndroidCanvas.kt call the following function
Copy code
image.asAndroidBitmap()
This function always throw UnsupportedOperationException("Unable to obtain android.graphics.Bitmap") which is correct because my CustomAndroidImageAsset is not AndroidImageAsset. Mabye you could expose AndroidImageAsset for external use as well ?
a
Assuming
p.bitmap
is an
android.graphics.Bitmap
, you can use the provided
Bitmap.asImageAsset()
to get one, making your initial code
Copy code
Image(p.bitmap.asImageAsset())
👍 1
s
Thanks you, it works perfectly !
👍 1