Created
March 29, 2016 03:38
-
-
Save appcoreopc/734767e3f6db1debc99a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SectionsPagerAdapter extends FragmentPagerAdapter { | |
public SectionsPagerAdapter(FragmentManager fm) { | |
super(fm); | |
} | |
@Override | |
public Fragment getItem(int position) { | |
// getItem is called to instantiate the fragment for the given page. | |
// Return a PlaceholderFragment (defined as a static inner class below). | |
return PlaceholderFragment.newInstance(position + 1); | |
} | |
@Override | |
public int getCount() { | |
// Show 3 total pages. | |
return 3; | |
} | |
@Override | |
public CharSequence getPageTitle(int position) { | |
switch (position) { | |
case 0: | |
return "SECTION 1"; | |
case 1: | |
return "SECTION 2"; | |
case 2: | |
return "SECTION 3"; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment