Heads up! To view this whole video, sign in with your Courses Plus account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video we'll talk about custom Views and then find some data to use!
Related Links
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[SOUND] Hi, I'm Ben, and in this workshop,
0:00
we're going to learn about custom views.
0:04
Even though Android has a ton of U types,
occasionally we need to make our own.
0:09
One common example of
this would be a graph.
0:14
Android doesn't give us any
tools to help visualize data.
0:17
So if we want to show a bar graph or a pie
chart, we're going to need a custom view.
0:20
And a graph is exactly what we're
going to be making in this workshop.
0:25
But to make it more exciting,
0:29
instead of graphing some boring fake data,
we're going to graph stock data.
0:30
And by the end of this workshop, you'll
have a complete stock chart that looks
0:34
just like what you'd see at a brokerage.
0:38
But before we get to the app,
let's take a minute to talk about
0:41
where we're going to get the data and what
type of stock chart we're going to create.
0:43
We'll be getting our data
from the NASDAQ web site.
0:48
Just search for the symbol you're
interested in, I'll use GOOG for
0:50
Alphabet Inc,
which is the company that owns Google.
0:54
Then on the left, pick Historical Quote.
0:57
And here, we've got data for
every day that the market was open.
1:03
We've got the date, what the price was
when the market opened, then the highest
1:06
and lowest prices during the day,
then the price when the market closed, and
1:10
finally, the volume, which is the number
of shares that traded that day.
1:15
So let's set the timeframe to something
like 2 years, and then at the very bottom,
1:19
We can click to download this file in
Excel format, which just gives us a CSV.
1:27
Nice, now to see what kind
of chart we'll be creating,
1:34
scroll back up to the top, and
click on Basic Chart on the left.
1:37
Then pick a timeframe of 1 month and
1:44
a chart type of candlestick,
and then click Update Chart.
1:47
And this is about what our
finished chart should look like,
1:52
with each day being
represented by a candlestick.
1:55
A candlestick is created by using
four of the values we just saw.
1:57
Here's a nice image from Wikipedia
explaining how they work.
2:01
Notice that the rectangle
part changes color,
2:04
depending on whether the closing price is
higher or lower than the opening price.
2:07
So back in the chart, on this day,
the close was lower than the open.
2:12
All right, now that we've got our data,
2:18
and we know how to turn it into a chart,
let's make an app.
2:20
Also, if you want some more
information about stocks or
2:23
candlestick charts,
check out the teacher's notes below.
2:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up