Back to project page face_rec_android.
The source code is released under:
GNU General Public License
If you think the Android project face_rec_android 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 in.amolgupta.helpingfaceless.activities; //from www . ja v a2s. c om import in.amolgupta.helpingfaceless.R; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBarActivity; public class HelpActivity extends FragmentActivity { public static final int NUM_PAGES = 5; private ViewPager mPager; private PagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle arg0) { setContentView(R.layout.fragment_help); super.onCreate(arg0); mPager = (ViewPager) findViewById(R.id.pager); mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter); } @Override public void onBackPressed() { if (mPager.getCurrentItem() == 0) { // If the user is currently looking at the first step, allow the // system to handle the // Back button. This calls finish() on this activity and pops the // back stack. super.onBackPressed(); } else { // Otherwise, select the previous step. mPager.setCurrentItem(mPager.getCurrentItem() - 1); } } /** * A simple pager adapter that represents 5 ScreenSlidePageFragment objects, * in sequence. */ private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter { public ScreenSlidePagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return new HelpItemFragment(position); } @Override public int getCount() { return NUM_PAGES; } } }