Android Question jrdc2 preoptimized lazy load bitmap image initialized2 error

zabayin

Member
Licensed User
Longtime User
i faced with little issue with my bitmap and hope someone point to me right direction.


This is the data pulling from mysql and set data to label .. last Line is :
    pclv.Initialize(Me,"pclv",clv_customer)
               
                pclv.AddItem(180dip,xui.Color_Black, _              
                rows(0) & "///" & _ 'id
                rows(1) & "///" & _ 'ccode
                rows(2) & "///" & _ 'cname
                rows(3) & "///" & _ 'phone
                rows(6) & "///" & _ 'homeno
                rows(4) & "///" & _ 'street
                rows(9) & "///" & _ 'product name
                rows(10) & "///" & _ 'unit credit
                rows(12) & "///" & _ 'change price
                rows(11) & "///" & _ 'sale price
                [B]rows(7))' <<< --------------- image from mysql database longblob (I know it is byte data and it's NOT String but i placed it)[/B]
                           
     
                               
            pclv.Commit





Then I extracted label value with SplitGetWord Function and all labels are lazy loading in runtime:
Sub clv_customer_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    For Each i As Int In pclv.VisibleRangeChanged(FirstIndex, LastIndex)
        Dim item As CLVItem = clv_customer.GetRawListItem(i)
        'Create the layout for item i and add it to item.Panel.
        Dim pnl As B4XView = xui.CreatePanel("")
        item.Panel.AddView(pnl, 0, 0, item.Panel.Width, item.Panel.Height)
        'Create the item layout
        pnl.LoadLayout("CustomerDetail")
       
       
       
        lbl_CID.Text = SplitGetWord(item.Value,"///",0)
        lbl_ccode.Text = SplitGetWord(item.Value,"///",1)
        lbl_cname.Text = SplitGetWord(item.Value,"///",2)
        lbl_cphone.Text = SplitGetWord(item.Value,"///",3)
        lbl_A.Text = SplitGetWord(item.Value,"///",4)
        lbl_B.Text = SplitGetWord(item.Value,"///",5)
        lbl_ProductName.Text = SplitGetWord(item.Value,"///",6)
        lbl_UnitCredit.Text = SplitGetWord(item.Value,"///",7)
        lbl_ChangePrice.Text = SplitGetWord(item.Value,"///",8)
        lbl_SalePrice.Text = SplitGetWord(item.Value,"///",9)
       
       
       
        Dim s As String
        s = SplitGetWord(item.Value,"///",10) '<<----- This is longblob data ([B@********)
       
        Dim bt() As Byte
   [B]     bt = s.GetBytes("UTF8")  '<< -------- I converted string to bytes (i need bitmap)[/B]
       

        Dim Buffer() As Byte
        Buffer = bt '<<----- This is Longblob data from mysql
               
        Dim InputStream1 As InputStream
        InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
               
        Dim bmp As Bitmap
        bmp.Initialize2(InputStream1)
        InputStream1.Close
           
          
'      iv_customer is ImageView
      [B]  iv_customer.Bitmap = bmp ' <---- This Line is Error ! I can't set Bitmap[/B]
       
   
       
    Next
End Sub


I pull the byte data and set it to string and change back to byte and set bitmap. seems that will be error loading in bitmap.
I stuck with 7 days coz i'm idiot. can someone help me. please. i want to convert back bitmap from string ... something like that.
 

zabayin

Member
Licensed User
Longtime User
found answer. let me share my ans for someone who faced like that


add list in global and initialize then ...:
         'Image
        Dim Buffer() As Byte
        Buffer = bm.Get(i) '<<----- where bm is list and i added byte data into it
 
Upvote 0
Top