Android Question How do I initialize a CustomListView?

Ronomega73

Member
Licensed User
Longtime User
Hello everyone, another newbie here with a question. How do I initialize a CustomListView? More specifically, what is vCallBack in .Initialize(vCallBack as Object, EventName as String)? Thanks a lot in advance.
 

Scotter

Active Member
Licensed User
Hope this helps. I'm pretty new myself.
Edit: I'm using the xCustomListView module v1.65
Taking this from a project I've been working on so some may not apply to your situation. It looks like I didn't have to explicitly initialize the CustomListView except to DIM (private) it in the globals area and then fill it with items:
B4X:
Sub Globals
    Private CLV_Feelings As CustomListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Dim iCounter=0 as int
    'read from text file
    Dim listFeelings = File.ReadList(File.DirAssets,"list_feelings.txt") As List
    iCounter=0
    Do While listFeelings.Size > iCounter
        CLV_Feelings.AddTextItem(listFeelings.Get(iCounter),listFeelings.Get(iCounter))
        iCounter=iCounter+1
    Loop
End Sub
 
Last edited:
Upvote 0

Ronomega73

Member
Licensed User
Longtime User
Thanks @Scotter. I am using the CustomListView class (for the first time) as posted here in the forum. I missed the part of the tutorial video by Erel where he added the CustomListView using the Designer. I tried to add the view by code instead and that's where the initialization error showed. I used the Designer and it's now working.

I will also try to use xCustomListView later and see if there's a difference.

But still, I think the ability to add CustomListView programmatically is important. So, any information about how to initialize a CustomListView by code would be much appreciated. That CallBack parameter is intriguing for me, to say the least.

I'll watch the tutorial video again next time as Erel said. Can't do it right now because our internet connection is very slow, perhaps maybe due to these being the holidays. Happy New Year everyone!!!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…