Search code examples
androidhibernatespring-bootpostgresql-9.3

How do I load images in android app from spring boot application?


I'm having issue with loading multiple images from database to android application using spring boot application?

i'm able to save images in my db but i don't know how do i load the images from db.


Solution

  • You can achieve it in two way :

    Buffer read from BLOB wrap in InputStream so you will have InputStream which will point to BLOB data

    Save BLOB data to temporary file open it as FileInputStream - so in the end you'll again have stream over image data

    in both cases you can easily convert InputStream to bitmat data in a way:

    InputStream is; //stream pointing to your blob or file
    //...
    
    imageView.setImageBitmap(BitmapFactory.decodeStream(is));