Android Question Retrive view from CLV inside CLV

HAH

Active Member
Licensed 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

Administrator
Staff member
Licensed 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
 

HAH

Active Member
Licensed 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 ..
 

HAH

Active Member
Licensed 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(??????)
 

HAH

Active Member
Licensed 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!
 

HAH

Active Member
Licensed User
B4X:
Dim lbl As B4XView = Sender
Log(lbl.Text)
Great idea & my problem is solved by this trick and by using tag property.
I know this trick is not related to clv inside clv, but it solved the problem.

Thank you
 
Top