Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.nika.recipes;
- import android.os.Bundle;
- import android.support.v7.app.AppCompatActivity;
- import android.widget.TextView;
- public class RecipeActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_recipe);
- int id = getIntent().getIntExtra("id", 1);
- String title = getIntent().getStringExtra("title");
- setTitle(title);
- String url = "http://cakes.abra.me/get_recipe?recipe_id=" + id;
- RecipeItem recipe = new RecipeItem(id, getApplicationContext());
- TextView ingredients = (TextView) findViewById(R.id.ingredients);
- for (RecipeItem.Ingredient ingredient : recipe.getIngredients()) {
- ingredients.append(ingredient.getString());
- }
- TextView finalWeight = (TextView) findViewById(R.id.final_weight);
- finalWeight.append(String.valueOf(recipe.getResultGrams()));
- TextView steps = (TextView) findViewById(R.id.steps);
- for (String step : recipe.getSteps()) {
- steps.append(step);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement