Android Question GetAllViewsRecursive

Pedro Caldeira

Active Member
Licensed User
Longtime User
Hello all,
I am trying to write a list, base son the type of view in a scrollview named 'vista'
I have labels and checkboxes, but I don't seem to get the type of view correctly.

B4X:
For Each v As View In vista.Panel.GetAllViewsRecursive
          
            If v Is Label Then
              
                Log("Label")
              
                Dim lb As Label = v
                lstChecklist.Add("B-" & lb.Text)
                Log("B-" & lb.Text)
          
            Else If v Is CheckBox Then
                Dim cb As CheckBox = v
              
                Log("CheckBox")
              
                If cb.Checked = True Then
                  
                    Dim ValC As String = "-T"
                Else
                    Dim ValC As String = "-F"
                End If
                Log("C-" & cb.Text & ValC)
                lstChecklist.Add("C-" & cb.Text & ValC)
            End If
        Next

I get all Labels
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top