There are a ReplaceAt method in the component CLV: ReplaceAt(index AS Int, pnl as B4XView, ItemSize as Int, Value as Object)
but I have only the Index.
Can I replace the text of AddTextItem use the ReplaceAt or only if I use a custom panel?
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
Log("Old value: " & Value)
Dim p As B4XView = CustomListView1.GetPanel(Index)
Dim x As String ="mynewvalue" & Index
p.GetView(0).text =x '1st label in item panel at given index i
p.RemoveViewFromParent
CustomListView1.ReplaceAt(Index,p,75dip,x)
End Sub
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
Log("Old value: " & Value)
Dim p As B4XView = CustomListView1.GetPanel(Index)
Dim x As String ="mynewvalue" & Index
p.GetView(0).text =x '1st label in item panel at given index i
p.RemoveViewFromParent
CustomListView1.ReplaceAt(Index,p,75dip,x)
End Sub
Thanks to @Mahares code but I wanted to use the same color and height as the original CustomListView even if @Erel don't want us to use the GetRawListItem method of CustomListView .
B4X:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
Log("Old value: " & Value)
Dim p As B4XView = CustomListView1.GetPanel(Index)
Dim x As String ="mynewvalue" & Index
p.GetView(0).text =x '1st label in item panel at given index i
p.RemoveViewFromParent
p.color = CustomListView1.GetRawListItem(Index).Panel.Color ' same color
CustomListView1.ReplaceAt(Index, p, CustomListView1.GetRawListItem(Index).Panel.Height, x) ' same height
End Sub