Java tutorial
/* * This file is part of Prepay Credit for Android * * Copyright 2013 Damien O'Reilly * * Prepay Credit for Android is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Prepay Credit for Android is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Prepay Credit for Android. If not, see <http://www.gnu.org/licenses/>. * * Report bugs or new features at: https://github.com/DamienOReilly/PrepayCredit * Contact the author at: damienreilly@gmail.com */ package damo.three.ie.ui; import android.content.Context; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import damo.three.ie.R; import damo.three.ie.fragment.AboutFragment; import damo.three.ie.fragment.ChangeLogFragment; /** * Class allows swiping between fragments in the 'About' section. */ public class ViewPagerAdapter extends FragmentPagerAdapter { private final Context context; public ViewPagerAdapter(FragmentManager fm, Context context) { super(fm); this.context = context; } @Override public Fragment getItem(int arg) { switch (arg) { case 0: return new AboutFragment(); case 1: return new ChangeLogFragment(); } return null; } @Override public int getCount() { return 2; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return context.getString(R.string.about); case 1: return context.getString(R.string.changelog); } return null; } }