Back to project page 50AndroidHacks.
The source code is released under:
Apache License
If you think the Android project 50AndroidHacks 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 com.github.yftx.AndroidHacks.sectionTipsAndTricks; //from w w w. jav a 2 s .com import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; /** * User: Liuzl * Date: 13-11-27 */ public class TestFragmentAdapter extends FragmentPagerAdapter{ protected static final String[] CONTENT = new String[] { "This", "Is", "A", "Test", }; private int mCount = CONTENT.length; public TestFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return TestFragment.newInstance(CONTENT[position % CONTENT.length]); } @Override public int getCount() { return mCount; } @Override public CharSequence getPageTitle(int position) { return TestFragmentAdapter.CONTENT[position % CONTENT.length]; } }