Android Question Add a new customlistview to an existing customlistview

jimseng

Active Member
Licensed User
Longtime User
Hello.
I am using the expandable list view example from this example: https://www.b4x.com/android/forum/threads/106148/#content
I am trying to understand how I can add another customlistview to the existing panels when an item when it is clicked. I might have 900+ elements and only want the information (in fact, ultimately and expandable list within within each item...eeek!) for each item that is clicked. I don't think this is quite the same as the lazy loading examples.
So basically it will be (I think) a custom list view with 900+ elements. When a user clicks on an element a new layout is loaded into the expanded view. (Then clicking on a "sub layout" will expand it to reveal a new layout labels/checkboxes)
I'm struggling to understand. Help!
 

jimseng

Active Member
Licensed User
Longtime User
I'm not sure if this is quite what I'm after. I have followed the example in my first post. I know how to add a custom views on the activity create. I want to be able to add a custom view to the already created custom view based on a click event and according how many items I need in the created custom view. as an example in the image below I might click on item #2, it expands to show 1 dynamically created entity, click on item #3 and it expands to show 3 entities. So I am getting the index of the expanded view, fetching some data and adding it to the (cutsom list view?) in the expanded view. I hope this makes sense.

clv.jpg
 

Attachments

  • clv.jpg
    clv.jpg
    31.6 KB · Views: 57
Upvote 0

jimseng

Active Member
Licensed User
Longtime User
Sure. Thanks for your help. I really appreciate it. I have added a layout with 1 label "lytA". I am trying to add it to the list on clv1_ItemClick. I can get the index of the item clicked but don't know how to specify the item to load the views to.
Ideally I would make each new item expandable...but 1 thing at a time I suppose.
 

Attachments

  • b4asample.zip
    12.4 KB · Views: 64
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I have added a layout with 1 label "lytA". I am trying to add it to the list on clv1_ItemClick. I can get the index of the item clicked but don't know how to specify the item to load the views to.

I think this is what you want to achieve based on your most recent post above although I have not used clv expandable for a while, so I am rusty
B4X:
Sub clv1_ItemClick (Index As Int, Value As Object)
    Log("clv1 index is "  & Index)
    Log(clv1.GetPanel(Index).GetView(0).GetView(0).Text)    'title of item clicked
    Dim p As B4XView =clv1.GetPanel(Index).GetView(1)  'expanded panel
    p.LoadLayout("lytA")       'added a label to the expanded panel
    expandable.ToggleItem(Index)
End Sub
 
Upvote 1

jimseng

Active Member
Licensed User
Longtime User
Hmmmn.
Turns out I don't understand. I have re attached my example. The layout "item" has a custom list view (clv2). I can load labels into it as per the example above but I think I have missed a step. I probably need to load the layout into the custom list view rather than with
B4X:
Dim p As B4XView =clv1.GetPanel(Index).GetView(1)  'CLV2
This should be easy but I just can't grasp the concept.
I think if someone runs the example you will get what I am trying to acheive
 
Upvote 0
Top