Build a Weather App
Treehouse
Course Summary
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 forecast.io. 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.
-
+
Course Description
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 forecast.io. 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.
Topics Covered
- 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 forecast.io.- Networking
Even though we use the Web in lots 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.
-
+
Course Syllabus
â— Exploring an APIâ—¦ Introducing Stormyâ—¦ What is an API? What Does it Mean to Use One?â—¦ The Forecast APIâ—¦ Creating the Projectâ—¦ Networkingâ— Networkingâ—¦ How Do We Get Data from the Web?â—¦ Networking on a Mobile Deviceâ—¦ Introducing OkHttpâ—¦ Getting the OkHttp Library Using Gradleâ—¦ Making an HTTP GET Request with OkHttpâ— Concurrency and Error Handlingâ—¦ Why Do We Use Asynchronous Processing?â—¦ Making Our Code Asynchronousâ—¦ Handling Errorsâ—¦ Configuring the Alert Dialogâ—¦ What To Do When the Network is Downâ— Working with JSONâ—¦ Exploring the Dataâ—¦ Creating the Modelâ—¦ Beautiful, Wonderful JSONâ—¦ Introducing JSONObjectâ—¦ Setting CurrentWeather from JSONâ—¦ Cleaning Up the Date and Timeâ—¦ Setting the Weather Iconâ— Building the Weather UIâ—¦ Starting at the Centerâ—¦ Adding the Upper Halfâ—¦ Working with LinearLayoutsâ—¦ Finishing the Lower Halfâ— Hooking Up the Model to the Viewâ—¦ Using Butter Knife for Viewsâ—¦ Plugging in the Dataâ—¦ Setting the Weather Iconâ—¦ Adding a Refresh Buttonâ—¦ Wrapping Up