Android Question ReplaceAt in a listview

Pacache

Member
Hello, i am using a Listview with text lines only.
I need to replace the contains of some specific lines with text.
I tried to use ReplaceAT but i don't know how to use it.
The instruction is "ReplaceAt(index AS Int, pnl as B4XView, itemsize as Int, value as Object)"
I just want to replace at index a text by another one !

Thanks a lot for helping
 

Mahares

Expert
Licensed User
Longtime User
I tried to use ReplaceAT but i don't know how to use it.
Here is an example that shows you how to replace text and panel color in an xClc item panel:
B4X:
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
    Dim p As B4XView = CustomListView1.GetPanel(Index)
    Dim selColor As Int = xui.Color_ARGB(255,144,238,144)
    p.Color = selColor
    Dim x As String ="Myxclv#:" & Index
    p.GetView(0).text =x    '1st label in item panel at given index i
    p.RemoveViewFromParent
    CustomListView1.ReplaceAt(Index,p,50dip,x)
End Sub
Don't refer to it as listview. Refer to it by any one of these: xClv, CLV, xCustomListView, CustomlistView. so to differentiate it from the old listview that is no longer recommended for new projects.
 
Upvote 3

Pacache

Member
Thanks a lot Mahares. It took me some time to understand your code but it helped understand how things work and thus use it my own way.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…