Android Question XUI in CustomListView - How to edit values

jtare

Active Member
Licensed User
Longtime User
How can I edit the values of a custom view class added to a custom list view?

I have a CLV in which I add items, I load a layout to the panel created in the designer view. This layout contains Custom Views like for example CircularProgressBar.

But how can I pick the CLV item and edit the CircularProgressBar value?
This is how I thought it could be done but didn't work, since the p.getview(2) is a panel, not a CircularProgressBar type.
B4X:
    Dim circular As CircularProgressBar = p.GetView(2)
    circular.Value = 56

Thanks
 

jtare

Active Member
Licensed User
Longtime User
Thank you, it worked.
For anyone wondering, this is how I did it:
CircularProgressBar1 is a temporary variable, it have the same name as the view in the designer. It is used only to save the class to the mBase tag.
B4X:
Sub Globals
    Private CircularProgressBar1 As CircularProgressBar
End Sub
Sub CreateListItemCircularProgressBar(text As String, Width As Int, Height As Int) As Panel
    Dim p As Panel
    p.Initialize("")
    p.SetLayout(0, 0, Width, Height)
    p.LoadLayout("itemCircularProgressBar")
    p.Color = Colors.White
    Dim lbl1 As Label = p.GetView(0)
    Dim lbl2 As Label = p.GetView(1)
    lbl1.Text = text
    lbl2.Text = text
    CircularProgressBar1.mBase.Tag = CircularProgressBar1
    Return p
End Sub
Sub Activity_Resume
    Dim Index As Int 'Index you want to change
    Dim p As Panel = CLV.GetPanel(Index)
    Dim circular As CircularProgressBar = p.GetView(2).Tag
    circular.Value = Rnd(0,101)
End Sub
 
Upvote 0
Top