Is there a way to get pages from TabStripViewPager? I have a requirement where some of the tabs will be using the same layout. So it makes sense to load the same layout file multiple times I think.
The trouble is, how do I set the information in the views on the layout when the user moves from one page to another? Is there a way to get the Panel that was loaded onto the ViewPager contained within TabStrip at the given position?
but basically there is an Event 'PageSelected' which is raised and you then use this to work out what to display as it knows the Current Page Index which you can get by using :
CurrentPage As Int [read only]
Gets the current page index.
The example is loading a different layout for every page so it is different from my use case. I want to have the same views on most tab pages so I use the same layout. The question is, although the event gives me the current page, how will I get the page's panel to modify the view contents?
There are all kinds of ways to access the pages. A generic solution that works whenever you use the same layout:
1. Create a global List named Pages.
2. Put the views in a panel named pnlBase and make it a global variable.
3.
B4X:
TabStrip.LoadLayout(...)
Pages.Add(pnlBase) 'pnlBase will point to the pnlBase from the last loaded layout
4. Access the page:
B4X:
'access the third panel:
Dim p As Panel = Pages.Get(2)