Bug? GetAllViewsRecursive and StdViewPager problem

Jerez

Active Member
Licensed User
Longtime User
Hi,

I've a StdViewPager with 6-7 pages. Each page has views based in same layout.

I need to iterate in all Views looking for a specific Tag contained inside of a StdViewPager.

If i go to page 3 for example and then iterate with GetAllViewsRecursive just found Views contained in current page and in best case the contiguous page.

If i go to page 4 and iterate again then GetAllViewsRecursive found the view.

NOTE: I've changed the StdViewPaget with an HorizontalScrollView and GetAllViewsRecursite works perfect... but when it is 'swiped' scroll to infinite... any way to stop in each panel? simulating scroll page by page?


Thanks !

B4X:
For Each v As View In Activity.GetAllViewsRecursive
if v is Imageview then
    dim iv as imageview = v
    [...]
end if
Next
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
any way to stop in each panel
exit the loop when you are in the right panel Or just check the view recursive of the active panel you need.
 

Jerez

Active Member
Licensed User
Longtime User
I think that is a bug.

An example:

Left side: StdviewPager...GetallViewsRecursive cannot get all views.
Right side: HorizontalScrollView... GetallViewsRecursive get all views with sucess!

NOTE: I would stay with the HorizontalScrollView but do not know how to advance page by page ...
 
Last edited:

Jerez

Active Member
Licensed User
Longtime User
The video is private.
Anyway it is not a bug.
Activity.GetAllViewsRecursive collects all the views that are children of the Activity (recursivly).

StdViewPager maintains its own set of views. Not all of them are part of the activity tree. So this method will not return it.

Check it again please.

I found the right way:

B4X:
For x = 0 To vp.Panels.Length -1
          
      For Each p As View In vp.Panels(x).GetAllViewsRecursive
          [...]
     Next
Next
 
Last edited:
Top