Return to Video

9 q Add code to list all dinners

  • 0:00 - 0:02
    In the next few sections,
  • 0:02 - 0:06
    we'll look at how to track the way your
    users view products and buy things.
  • 0:06 - 0:09
    This course does not teach how to
  • 0:09 - 0:11
    implement the shopping
    cart functionality.
  • 0:11 - 0:16
    What it does teach is how to add
    Analytics code to report data
  • 0:16 - 0:20
    about the different steps
    in the shopping process.
  • 0:20 - 0:23
    However, our dinner app needs
    a bit more functionality
  • 0:23 - 0:25
    to be useful as a learning tool,
    in this case.
  • 0:26 - 0:31
    You'll add an activity to the app
    to display all the dinners.
  • 0:31 - 0:34
    This list will let your users
    see all the dinner choices and
  • 0:34 - 0:36
    pick which ones they want to view.
  • 0:38 - 0:42
    The dinner class already has a method,
    getAllDinners,
  • 0:42 - 0:44
    that returns a list of all the dinners.
  • 0:45 - 0:47
    So now we need to add an activity.
  • 0:47 - 0:49
    To display all the dinners
    as a scrolling list.
  • 0:50 - 0:53
    We also need to add
    a button on the home screen
  • 0:53 - 0:57
    that starts the activity
    to display all the dinners.
  • 0:58 - 1:01
    So you're going to need to
    add some code to your app.
  • 1:01 - 1:05
    To start with, you're going to need to
    add the ShowAllDinnersActivity class.
  • 1:05 - 1:11
    And then you'll need to add the method
    showDinnerList in the Main Activity.
  • 1:11 - 1:14
    And the onClick action
    of the items in the list
  • 1:14 - 1:16
    will be to go to
    the Order Dinner screen.
  • 1:17 - 1:19
    So, currently the Order Dinner
    screen just displays an info
  • 1:19 - 1:21
    box about ordering the dinner.
  • 1:22 - 1:25
    But as you work through the next few
    sections, you'll be adding buttons to
  • 1:25 - 1:27
    this screen to simulate steps
    in the purchase process.
  • 1:28 - 1:34
    So you'll need to add the Show all
    the Dinners button to activity_main.xml.
  • 1:34 - 1:38
    And then you're going to need the layout
    files for the scrolling list of dinners.
  • 1:38 - 1:45
    So you'll add list_all_dinners.xml for
    the scrolling list itself.
  • 1:45 - 1:49
    Then show_dinner_in_row.xml for
    each row in the list.
  • 1:49 - 1:54
    If you're up for the challenge,
    write the code yourself, or
  • 1:54 - 1:59
    if you want, you can just get the
    predefined code from GitHub, up to you.
Title:
9 q Add code to list all dinners
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
UD876-2 - Google Play Services - Analytics

English subtitles

Revisions Compare revisions