Android Question [Solved] How to use ReplaceAt in a CustomListView filled with AddTextItem?

asales

Expert
Licensed User
Longtime User
I have a CLV filled with AddTextItem method.

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?

Thanks in advance for any help.
 
Solution
Can I replace the text of AddTextItem use the ReplaceAt
Yes, you can. I am pretty sure this is it:
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
    CustomListView1.ReplaceAt(Index,p,75dip,x)
End Sub

Mahares

Expert
Licensed User
Longtime User
Can I replace the text of AddTextItem use the ReplaceAt
Yes, you can. I am pretty sure this is it:
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
    CustomListView1.ReplaceAt(Index,p,75dip,x)
End Sub
 
Upvote 1
Solution
Top