Code example for FragmentActivity

Methods: finish

0
                    // with a synthesized back stack. 
                    TaskStackBuilder.from(this)
                            // If there are ancestor activities, they should be added here. 
                            .addNextIntent(upIntent)
                            .startActivities(); 
                    finish(); 
                } else { 
                    // This activity is part of the application's task, so simply 
                    // navigate up to the hierarchical parent activity. 
                    NavUtils.navigateUpTo(this, upIntent);
                } 
                return true; 
        } 
        return super.onOptionsItemSelected(item);
    } 
 
    /** 
     * A {@link android.support.v4.app.FragmentStatePagerAdapter} that returns a fragment 
     * representing an object in the collection. 
     */ 
    public static class DemoCollectionPagerAdapter extends FragmentStatePagerAdapter {