How to display image from blob data in android sqlite?

前端 未结 1 565
误落风尘
误落风尘 2021-01-26 06:52

I have been trying to store image form android sdcard to the sqlite database. And it worked fine. The image is getting stored into the database as blob. This is the rough code I

相关标签:
1条回答
  • 2021-01-26 07:29

    I have found a solution. Thanks to all.

    I have used base64 encoding method. ie; For displaying the image, I have been using a hash map to get the result first of all from the database table. So before saving into the map, I have encoded the bytes to string using base 64 method. Then On the Activity side for displaying the image, I have decoded back the string using base 64 again and then converted to bytes and the image got displayed.

    0 讨论(0)
提交回复
热议问题