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