Android Tutorial RDC: How to load blob and fill in to the imageview

Hi All,

With RDC i try to load blob and fill in to the imageview, but not success. Can anybody help me to find what is wrong wih my script :

B4X:
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = reqManager.HandleJob(Job)
           
            'Isi Map Period
            Private mapResultSet As Map
            mapResultSet = reqManager.GetRecsTable(result)
           
            'Set lblDate value
            Dim mapRecord As Map : mapRecord.Initialize
            mapRecord = mapResultSet.GetValueAt(0)       
           
            lblDateVal.Text =  mapRecord.Get("Date")           
            lblAchievementVal.Text =  mapRecord.Get("Ratio")           
            lblAchievementDes.Text =  mapRecord.Get("Point")           
            txtRoot.Text =  mapRecord.Get("Root")           
            txtAction.Text =  mapRecord.Get("Plan")       
           
            Dim Buffer() As Byte
            Buffer = mapRecord.Get("Gambar")
            Dim InputStream1 As InputStream
            InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
          
            Dim Bitmap1 As Bitmap
            Bitmap1.Initialize2(InputStream1)
            InputStream1.Close
            imgView.Bitmap = Bitmap1               
                                   
            '--------------------------
            ProgressDialogHide

Warm Regards,
RAD
 

rad

Member
Licensed User
Longtime User
I have try to change the script with this :

B4X:
            For Each records() As Object In result.Rows
                lblDateVal.Text = records(result.Columns.Get("Date"))
                lblAchievementVal.Text =  records(result.Columns.Get("Ratio"))   
                lblAchievementDes.Text =  records(result.Columns.Get("Point"))           
                txtRoot.Text =  records(result.Columns.Get("Root"))           
                txtAction.Text =  records(result.Columns.Get("Plan"))   
       
                Dim oBitMap As Bitmap
                Dim Buffer() As Byte              
                Buffer = records(result.Columns.Get("Gambar")) ' Image Column
                oBitMap = reqManager.BytesToImage(Buffer)
                imgView.Bitmap = oBitMap              
            Next

But, not success too....
 

rad

Member
Licensed User
Longtime User
I have change field blob to longblob, and the it run successfully....

Thanks Anyway.
Warm Regards,
RAD
 
Top