Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package com.example.nika.recipes;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.widget.TextView;
  6.  
  7. public class RecipeActivity extends AppCompatActivity {
  8.  
  9. @Override
  10. protected void onCreate(Bundle savedInstanceState) {
  11. super.onCreate(savedInstanceState);
  12. setContentView(R.layout.activity_recipe);
  13.  
  14. int id = getIntent().getIntExtra("id", 1);
  15. String title = getIntent().getStringExtra("title");
  16.  
  17. setTitle(title);
  18.  
  19. String url = "http://cakes.abra.me/get_recipe?recipe_id=" + id;
  20.  
  21. RecipeItem recipe = new RecipeItem(id, getApplicationContext());
  22.  
  23.  
  24. TextView ingredients = (TextView) findViewById(R.id.ingredients);
  25. for (RecipeItem.Ingredient ingredient : recipe.getIngredients()) {
  26. ingredients.append(ingredient.getString());
  27. }
  28. TextView finalWeight = (TextView) findViewById(R.id.final_weight);
  29. finalWeight.append(String.valueOf(recipe.getResultGrams()));
  30. TextView steps = (TextView) findViewById(R.id.steps);
  31. for (String step : recipe.getSteps()) {
  32. steps.append(step);
  33. }
  34.  
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement