Guest User

Untitled

a guest
Jun 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public class RecipeActivity extends AppCompatActivity {
  2. private Recipe mRecipe = null;
  3.  
  4. @Override
  5. public void onCreate(@Nullable Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7.  
  8. // Supporting going back to the list of recipes.
  9. if (getSupportActionBar() != null) {
  10. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  11. }
  12.  
  13. // Determine if the activity is started from another, thus try to parse the activity desired
  14. // extras.
  15. Intent intent = getIntent();
  16. if (intent != null && intent.hasExtra(getString(R.string.key_recipe))) {
  17. this.mRecipe = intent.getParcelableExtra(getString(R.string.key_recipe));
  18. }
  19.  
  20. if (this.mRecipe != null) {
  21. setTitle(this.mRecipe.getName());
  22. }
  23. }
  24. }
Add Comment
Please, Sign In to add comment