Android Question Custom List View Help

Sanxion

Active Member
Licensed User
Longtime User
Hi all

I am using Erel's Custom List View class to create a modified custom list view and I am not sure about how to use the 'Value' parameter here:

B4X:
'Adds a custom item.
Public Sub Add(Pnl As Panel, ItemHeight As Int, Value As Object)
    InsertAt(items.Size, Pnl, ItemHeight, Value)
End Sub

My method to add to the custom list view is:

B4X:
cvWords.Add(CreateListItem(id,Eng,Ar,cvWords.AsView.Width,50)50dip, ???)

My CreateListItem signature is (Erel's example uses one string whereas I have three):

B4X:
Sub CreateListItem(ID As String, EW As String, AW As String, Width As Int, Height As Int) As Panel

I am sure it is something quite simple...

Thanks
 

mangojack

Expert
Licensed User
Longtime User
The supplied value is Returned in the item Click event ...

from the example ..
B4X:
clv3.Add(CreateListItem("Item #" & i, clv3.AsView.Width, 50dip), 50dip, "Return Value Item #" & i)  '@@ Click Event Value ...
B4X:
Sub clv3_ItemClick(Index As Int, Value As Object)
   Log(Index & " = " & Value)
End Sub

you can access this value for any view Click events you create by calling clv3.GetValue(index)
B4X:
'Returns the value stored at the specified index.
Public Sub GetValue(Index As Int) As Object
   Return items.Get(Index)
End Sub
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…