Code example for FragmentActivity

Methods: onOptionsItemSelected

0
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            mPager.setCurrentItem(0);
            return true; 
        } 
        return super.onOptionsItemSelected(item);
    } 
 
    public static class PagerAdapter extends FragmentStatePagerAdapter { 
        public PagerAdapter(FragmentManager fm) {
            super(fm);
        } 
 
        @Override 
        public Fragment getItem(int position) {
            return AdFragment.newInstance(position);
        } 
 
        @Override 
        public int getCount() { 
            return NUM_ITEMS;