0

Hi i want to download a image from webservice for that i use this code for webservice:

 <WebMethod()> _
Public Function RC_GetImages(Code As Int32) As [Byte]()

    Dim ConSqlhi As New SqlConnection(My.Settings.connecttolocal)
    Dim cmd As New SqlCommand()

    cmd.Connection = ConSqlhi
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "GetImage"

    Try
        cmd.Parameters.Add("@code", SqlDbType.Int).Value = Code
        Dim dr As SqlDataReader = cmd.ExecuteReader()
        dr.Read()
        Dim ar As [Byte]() = DirectCast(dr(1), [Byte]())
        dr.Close()
        cmd.Dispose()
        Return ar

    Catch ex As Exception
        Dim a As [Byte]()
        Return a
        Exit Function

    End Try

    ConSqlhi.Close()

End Function      

and I have no idea how can I get this image in android.
so can anyone help me about this?
image is in my database and I get it from stored procedure

max
  • 5,963
  • 12
  • 49
  • 80
  • Have you tried converting the Byte array to Base64 string and sending it to your mobile when the service is called? In your android client, you would then convert the Base64 string to Byte array and then Byte array to File or Bitmap depending on what you intend to do. – Much Overflow Feb 01 '16 at 11:14
  • hi thanks for attention but do you have any code snip for that – max Feb 01 '16 at 11:20
  • Converting Byte array to Base64 https://msdn.microsoft.com/en-us/library/dhx0d524(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1 Converting Base64 to Bitmap in Android http://stackoverflow.com/questions/4837110/how-to-convert-a-base64-string-into-a-bitmap-image-to-show-it-in-a-imageview – Much Overflow Feb 01 '16 at 11:25

0 Answers0