Android Question rdc bitmap

buras3

Active Member
Licensed User
Longtime User
Hello

I am new to images manipulation
My question is how to download bitmap from the sql server
I can upload the bitmap as buffer()

i use service and get the result in "Sub JobDone(Job As HttpJob)"
but when i download to
"Table As DBResult" the buffer is too short
i tried job.getbitmap but i get an error
how can i get the bitmap ?

tank you
Michael
 

buras3

Active Member
Licensed User
Longtime User
i did but i get part of the value
[B@43e0cbf8

B4X:
Dim result As DBResult = reqManager.HandleJob(Job)
     CallSub2(Mana, "Save_Manot", result )

B4X:
Sub Save_Manot(Table As DBResult)
Dim ArryRow(4) As String
Dim i As Int
   For Each row() As Object In Table.Rows
     i=0
     For Each record As Object In row
       If i=0 Then ' first col

           Log(record)
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
ok i checked again and the record is full but still no image showing

B4X:
  For Each row() As Object In Table.Rows
     i=0
     For Each record As Object In row
       If i=2 Then
         Dim ins As InputStream
        Dim bmp As Bitmap
         
           Dim jpeg() As Byte
        jpeg=record
         
         ins.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
        bmp.Initialize2(ins)
         
         ImgMana.Color=Colors.Black
         ImgMana.Bitmap=bmp

what am i doing wrong?
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
I did tried this also
the byte array is full
the bmp has size

upload_2014-12-24_13-48-11.png
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
the log(bmp)
(Bitmap): 1840 x 3264

i also checked the sql server with sql image viewer and the images are valid there

the mWidth of the bmp is -1 (0xFFFFFFFF)
is it a problem ?
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
i have tried SetBackgroundImage
and saving the file (not saving - no error)

B4X:
bmp=DB_Service.reqManager.BytesToImage(record)
ons= File.OpenOutput(File.DirRootExternal & "/DiningRoom","test.jpg", False)
bmp.WriteToStream(ons,100,"JPEG" )
ons.Close
 
Upvote 0

buras3

Active Member
Licensed User
Longtime User
Ok i don't know why but i changed the package name from b4a.example to a new name
and every thing is working fine
now i will remember for sure to change it first thing for my next projects :)
tank you for the help
 
Upvote 0
Top