Code example for FragmentPagerAdapter

0
    int mCurPos;
 
    class MyPagerAdapter extends FragmentPagerAdapter implements ViewPager.OnPageChangeListener { 
 
        public MyPagerAdapter(FragmentManager fm) {
            super(fm);
        } 
 
        @Override 
        public Fragment getItem(int position) {
            return new AppOpsCategory(sPageTemplates[position]);
        } 
 
        @Override 
        public int getCount() { 
            return sPageTemplates.length;
        } 
 
        @Override 
        public CharSequence getPageTitle(int position) {
            return mPageNames[position];