nibbo Active Member Licensed User Longtime User Jul 1, 2014 #1 Hi, I am trying to loop through a scroll view and remove panels with a known tag. I have tried the code below: B4X: For Each v As View In sv.Panel If v.Tag="XXX" Then v.RemoveView End If Next This seems to work for the first 3 or 4 but then fails saying java.lang.RuntimeException: Object should first be initialized (View).
Hi, I am trying to loop through a scroll view and remove panels with a known tag. I have tried the code below: B4X: For Each v As View In sv.Panel If v.Tag="XXX" Then v.RemoveView End If Next This seems to work for the first 3 or 4 but then fails saying java.lang.RuntimeException: Object should first be initialized (View).
Erel B4X founder Staff member Licensed User Longtime User Jul 1, 2014 #2 You should not modify the list while you iterate over it. B4X: For i = sv.Panel.NumberOfViews - 1 To 0 Step -1 Dim v As View = sv.Panel.GetView(i) If v.Tag Then ... Next Upvote 0
You should not modify the list while you iterate over it. B4X: For i = sv.Panel.NumberOfViews - 1 To 0 Step -1 Dim v As View = sv.Panel.GetView(i) If v.Tag Then ... Next
nibbo Active Member Licensed User Longtime User Jul 1, 2014 #3 Erel said: You should not modify the list while you iterate over it. B4X: For i = sv.Panel.NumberOfViews - 1 To 0 Step -1 Dim v As View = sv.Panel.GetView(i) If v.Tag Then ... Next Click to expand... Thanks Erel, rookie mistake... Upvote 0
Erel said: You should not modify the list while you iterate over it. B4X: For i = sv.Panel.NumberOfViews - 1 To 0 Step -1 Dim v As View = sv.Panel.GetView(i) If v.Tag Then ... Next Click to expand... Thanks Erel, rookie mistake...