Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Creating the Model1:48 with Ken Alger
We can now create some data model objects to hold the data we are getting from the Dark Sky service.
Back here in Android Studio, let's create a new class in our project.
New Java class, we'll call it current weather.
And hit OK.
Cool, next, let's define our variables.
So we need a private string.
We'll need one for the location label.
We'll need a private string for our icon.
A private long for our time.
The temperature is in double value.
As is humidity.
And for precipitation we'll do a precipChance.
And we'll need a string for our summary.
Now we just need to type out all of our getters and setters.
Well, okay, let's not type them all out.
We can use Android Studio's auto generation feature to accomplish this.
If we go to Code, Generate, Getter and Setter,
we can select all the variables, and hit OK.
And there they are.
This is a great start for our data model.
We'll be making a few tweaks as we continue on with the project.
For now, though, let's jump back and look at this data format called JSON.
You need to sign up for Treehouse in order to download course files.Sign up