Build a Weather App (Refresh)
Coming March 2018…
About this Course
In this course, we will learn about a very common and important element of Android development: downloading data from the Internet! We will request weather forecast data from a free API provided by darksky.net. We will then parse that data (in JSON format) and display it in a single-page app. We will also see how to handle errors and situations when the network is unavailable.
What you'll learn
- Using an API
- Parsing JSON
- Using a DialogFragment
Exploring an API
What is an API? What does it mean to use one? This stage will introduce the project and explore an API provided by darksky.net.
Even though we use the Web in a lot of ways in our daily lives, communicating with the Web and interacting with the information we get is not a trivial task. Let's see how to make networking in Android easy with the help of a 3rd party library called OkHttp.
Concurrency and Error Handling
Concurrency, or doing things together in parallel, is an important property of our system that let's us execute blocks of code simultaneously. In this stage, we take a look at what concurrency exactly means, why it's necessary, and how to make our networking call in a concurrent manner. We'll also learn how to gracefully handle any errors.
Working with JSON
Our weather data is in the JSON format, which is a way of representing data in a simple-to-read manner that is easily parsed and used by programming languages. In this stage we will learn how to parse that data and store it in Java model objects that we can use in our app.
Building the Weather UI
With all the pieces in place, we can finally display our forecast data in an interface designed by one of our Treehouse designers.
Hooking Up the Model to the View
Our last task is to wire up the data from our CurrentWeather model to our freshly implemented user interface.