English subtitles

← 9 q Add code to list all dinners

Get Embed Code
4 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. In the next few sections,
  2. we'll look at how to track the way your
    users view products and buy things.
  3. This course does not teach how to
  4. implement the shopping
    cart functionality.
  5. What it does teach is how to add
    Analytics code to report data
  6. about the different steps
    in the shopping process.
  7. However, our dinner app needs
    a bit more functionality
  8. to be useful as a learning tool,
    in this case.
  9. You'll add an activity to the app
    to display all the dinners.
  10. This list will let your users
    see all the dinner choices and
  11. pick which ones they want to view.
  12. The dinner class already has a method,
    getAllDinners,
  13. that returns a list of all the dinners.
  14. So now we need to add an activity.
  15. To display all the dinners
    as a scrolling list.
  16. We also need to add
    a button on the home screen
  17. that starts the activity
    to display all the dinners.
  18. So you're going to need to
    add some code to your app.
  19. To start with, you're going to need to
    add the ShowAllDinnersActivity class.
  20. And then you'll need to add the method
    showDinnerList in the Main Activity.
  21. And the onClick action
    of the items in the list
  22. will be to go to
    the Order Dinner screen.
  23. So, currently the Order Dinner
    screen just displays an info
  24. box about ordering the dinner.
  25. But as you work through the next few
    sections, you'll be adding buttons to
  26. this screen to simulate steps
    in the purchase process.
  27. So you'll need to add the Show all
    the Dinners button to activity_main.xml.
  28. And then you're going to need the layout
    files for the scrolling list of dinners.
  29. So you'll add list_all_dinners.xml for
    the scrolling list itself.
  30. Then show_dinner_in_row.xml for
    each row in the list.
  31. If you're up for the challenge,
    write the code yourself, or
  32. if you want, you can just get the
    predefined code from GitHub, up to you.