I really like the template for Tabs+Swipe. You know…this one:

The problem is, I do not know where to start after creating that template. How to put a layout into each tab page?
Can we do something like call a Class when the tab is selected? So I can store the view for first tab in Class A then second tab in Class B.
I cannot found any information about this in Google, maybe because it is a new feature from Android SDK?
Thanks
The generated code creates a
ViewPagerin the layout file and wires up action bar tabs to the pages in thatViewPager. Personally I’d rather use aPagerTabStrip, or possibly one of the ViewPagerIndicator equivalents, but they didn’t ask me… 🙂Regardless, to fill in the pages, you need to replace (or complete) the
SectionsPagerAdapterand/orDummySectionFragmentinner classes of the generated activity. Right now, this is set up to have three pages, each of which is merely aTextView. But, you could haveDummySectionFragmentinflate a layout instead, and if you are looking for different layouts per tab, you would probably create separateFragmentimplementations per layout/tab combination. You would then teachSectionsPagerAdapterhow many pages you want (getCount()) and what to use for each page (getItem()) and what each tab caption is (getPageTitle()).