Android Question Read image from Database (SQL Server)

Discussion in 'Android Questions' started by Carles Escudé, Jun 25, 2015.

  1. Carles Escudé

    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!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Is it base 64 encoded?
     
  3. Carles Escudé

    Carles Escudé Member Licensed User

    No. It is not coded. It is saved as byte()

    I am trying this, but do not work:

    Code:
    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: Jun 25, 2015
  4. Carles Escudé

    Carles Escudé Member Licensed User

Loading...