Android Question how do i change an item in xcustomlistview ?

Addo

Well-Known Member
Licensed User
Longtime User
Lets say that I have item1 how to access its data and update it ? Or is there documentation or code sample for that purpose ? I looked into xcustomelistview demo but update items is not implemented there
 
Upvote 0

Addo

Well-Known Member
Licensed User
Longtime User
i looked into the demo but i got difficulty to understand i create items like this what i am trying to do to loop through the clv and update item where item equals item1

what i am trying to update is its label text and image with new data


B4X:
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
   Dim p As Panel
   p.Initialize("")
   p.SetLayout(0, 0, Width, Height)
   p.LoadLayout("cellitem")
   itmlbl.Text = "item1"
   label1.Text = " updated data "
   label2.Text = "updated results "
   img1.Bitmap = LoadBitmap(File.DirAssets, "1.png")
   Return p
End Sub
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
img1.Bitmap = LoadBitmap(File.DirAssets, "1.png")
Never load the same bitmap more than once.

The actual code depends on the layout tree.
If itmlbl is the first view in the layout then:
B4X:
For i = 0 to CLV.Size - 1
 Dim p As B4XView = CLV.GetPanel(i)
 Log(p.GetView(0).Text)
Next
 
Upvote 0
Top