Code example for FragmentActivity

Methods: getIntent, getSupportFragmentManager, onCreate

0
	public static final String EXTRA_RECIPE_INDEX = "recipeIndex"; 
 
	/** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
    	super.onCreate(savedInstanceState); 
    	 
    	// Get the recipe index 
    	int recipeIndex = getIntent().getIntExtra(EXTRA_RECIPE_INDEX, -1); 
    	 
    	// Show the new fragment (full screen) 
    	RecipeDetail details = RecipeDetail.newInstance(recipeIndex); 
        getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit(); 
    	 
    } 
     
}