Search code examples
androidbase64android-jetpack-composeimage-loading

How can I display a base64-encoded image in Jetpack Compose without using external libs


I could convert the base64 string to android.graphics.Bitmap but from all I can find online, I still need coil or glide to display it


Solution

  • If you have a Bitmap you can use the .asImageBitmap() extension to get a Compose ImageBitmap object.

    Then use it in an Image composable.

    Image(
        bitmap = bitmap.asImageBitmap(),
        contentDescription = "contentDescription"
    )