1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question UXI Card Example Question

Discussion in 'Android Questions' started by John Decowski, Aug 18, 2019.

  1. John Decowski

    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.
     
  2. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    No, you can access the views inside the card and then you can update the values.
     
  3. John Decowski

    John Decowski Member Licensed User

    @Alexander Stolte how do you update the values? I tried accessing the views as array but they are not arrays.
     
  4. DonManfred

    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 likes this.
  5. John Decowski

    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.
     
  6. Alexander Stolte

    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.
     
    José J. Aguilar and Erel like this.
  7. John Decowski

    John Decowski Member Licensed User

    Thank you I will give it a look!
     
  8. mangojack

    mangojack Well-Known Member Licensed User

    This will work with the CardList Example project ...
    Code:
    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
     
    Alexander Stolte and Erel like this.
  9. John Decowski

    John Decowski Member Licensed User

    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!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice