Android Question Retrive view from CLV inside CLV

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
I have clv containing labels inside another clv.
clv
--clv
----label1
----label2
----label3
----label4

How can I retrieve label1,2,3,4 values triggered by label click event?
* clv means customlistview
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
CLVs shouldn't be nested unless you are using CLVNested: https://www.b4x.com/android/forum/threads/107742/#content

The standard way to get a custom view from the layout tree: [B4X] How to get <custom view here> from <CLV or any other container>

However this will not work with CLV as it was implemented before this convention.
You can do it yourself:
B4X:
pnl.LoadLayout(...)
CLV.AsView.Tag = CLV
This will allow you to get the CLV from the tag with something like:
B4X:
Dim clv As CustomListView = CLV1.GetPanel(x).GetView(0).Tag
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
I added it simply & successfully clv inside clv, but the problem was how can I obtain labels inside!

CLVs shouldn't be nested unless you are using CLVNested: https://www.b4x.com/android/forum/threads/107742/#content
I can't change clv to nestedclv because my project is large & already written, also it will be broken if changed!

This will allow you to get the CLV from the tag with something like:
B4X:
Dim clv As CustomListView = CLV1.GetPanel(x).GetView(0).Tag
tested, not worked!

Any suggestion please ..
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
I have trying to use clvnested, the problem is that I want to add it inside tabstrip page, what parent view should be?
B4X:
nested.Initialize(??????)
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
B4X:
CustomListView1.Add(pnl, CustomListViewchild)

Dim clv As CustomListView = CustomListView1.GetValue(0)
clv.GetPanel(0).GetView(0).GetView(0).Text = "aaa"
Can you implement it inside Label1_Click event "in example clvinclv.zip above" , to get the text of clicked label, please.
I tried & failed!
 
Upvote 0
Top