Android Question UXI Card Example Question

John Decowski

Member
Licensed User
https://www.b4x.com/android/forum/threads/cards-list-with-customlistview.87720/#content

Just had a question about how the correct method would be to modify a value of a view inside of the card panel after it has been created. Would you have to delete all the cards and recreate them? Or can you modify it passively? The link to the example project is above. Love this example just trying to figure out how to incorporate it into my app. Thanks in advance.
 

DonManfred

Expert
Licensed User
what let you think they are arrays?

The cards are layouts like any other layouts too. A card hold all objects from the layout loaded to this Card.
See how customlistview is working.
Basically the views are children of the base panel.
 

John Decowski

Member
Licensed User
@DonManfred I understand about the card being a placeholder for the views inside the panel, but am unsure how to access each individual view inside of it. Ie . Being able to change label1.text vaule. I tried changing to value of the declared view and it simply changes just the last card added.

Thanks in advance.
 

Alexander Stolte

Well-Known Member
Licensed User
If you look at your designer, if you have a panel and on this panel is a other view, then the panel is the base and the view on it is the children.

You can access it over the base panel, this means: basepanel.getview(0).text = ""

Look the Tutorial from Erel here, on the end of this video he is showing you how to access views in the list.
 

John Decowski

Member
Licensed User
If you look at your designer, if you have a panel and on this panel is a other view, then the panel is the base and the view on it is the children.

You can access it over the base panel, this means: basepanel.getview(0).text = ""


Look the Tutorial from Erel here, on the end of this video he is showing you how to access views in the list.
Thank you I will give it a look!
 

mangojack

Well-Known Member
Licensed User
This will work with the CardList Example project ...
B4X:
Sub lblAction1_Click
    Dim index As Int = CLV1.GetItemFromView(Sender)      
    Dim pnl1 As B4XView = CLV1.GetPanel(index)            'base panel
    Dim pnl2 As B4XView = pnl1.GetView(0)                    'Card1 layout panel
    pnl2.GetView(3).Text = "This Item Title has been edited ! ... "    'view(3) = 4th label on panel...  refer order in Designer ViewTree for Card1 layout

    'long way
    Dim img As B4XView = pnl2.GetView(2)
    img.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "pexels-photo-446811.jpeg", ImageView1.Width, ImageView1.Height, True))
End Sub
 

John Decowski

Member
Licensed User
This will work with the CardList Example project ...
B4X:
Sub lblAction1_Click
    Dim index As Int = CLV1.GetItemFromView(Sender)     
    Dim pnl1 As B4XView = CLV1.GetPanel(index)            'base panel
    Dim pnl2 As B4XView = pnl1.GetView(0)                    'Card1 layout panel
    pnl2.GetView(3).Text = "This Item Title has been edited ! ... "    'view(3) = 4th label on panel...  refer order in Designer ViewTree for Card1 layout

    'long way
    Dim img As B4XView = pnl2.GetView(2)
    img.SetBitmap(xui.LoadBitmapResize(File.DirAssets, "pexels-photo-446811.jpeg", ImageView1.Width, ImageView1.Height, True))
End Sub
Thank you! I wasn't understanding how to access the views , and your example makes sense now. I didnt realize that it was the order in the designer! Thanks again appreciate it!
 
Top