Android Question Getting pages from TabStripViewPager

Haris Hafeez

Active Member
Licensed User
Longtime User
Hi,

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?
 

eps

Expert
Licensed User
Longtime User
Upvote 0

Haris Hafeez

Active Member
Licensed User
Longtime User
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?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
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)
 
Upvote 0
Top