Back to project page Swipe-Tabs.
The source code is released under:
MIT License
If you think the Android project Swipe-Tabs listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package it.bellotti.android.swipetabs.adapters; //from ww w . j ava2s . c om import android.content.Context; import it.bellotti.android.swipetabs.R; import it.bellotti.android.swipetabs.fragments.CalendarFragment; import it.bellotti.android.swipetabs.fragments.HomeFragment; import it.bellotti.android.swipetabs.fragments.StatisticsFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class TabsPagerAdapter extends FragmentPagerAdapter { public final static int PAGES = 3; private Context context; public TabsPagerAdapter(Context context, FragmentManager fm) { super(fm); this.context = context; } @Override public Fragment getItem(int index) { switch (index) { case 0: return new HomeFragment(); case 1: return new StatisticsFragment(); case 2: return new CalendarFragment(); } return null; } @Override public int getCount() { return PAGES; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return context.getString(R.string.fragment_home); case 1: return context.getString(R.string.fragment_statistics); case 2: return context.getString(R.string.fragment_calendar); default: return null; } } }