Android Question Read image from Database (SQL Server)

Carles Escudé

Member
Licensed User
Hi,
I have an image loaded in SQL Server in "image" datatype.

I download it using an HttpJob and JSON.

Which is the best way to load it in a imageview?

Thanks in advance!
 

Carles Escudé

Member
Licensed User
No. It is not coded. It is saved as byte()

I am trying this, but do not work:

B4X:
Dim p As JSONParser
p.Initialize(Job.GetString)
Dim list1 As List
list1 = p.NextArray
Dim map1 As Map
map1 = list1.get(0)
Dim IMG As String = map1.get("IMG")                
                
Dim Buffer() As Byte = IMG.GetBytes("UTF8")
            
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
               
Dim Bitmap1 As Bitmap
Bitmap1.Initialize2(InputStream1)
InputStream1.Close
logo.Bitmap = Bitmap1
Error on Bitmap1.Initialize2(InputStream1) --> java.lang.RuntimeException: Error loading bitmap.
 
Last edited:
Top