Course

Build a Blog Reader Android App

The Blog Reader app will teach us one of the most common and important uses of an Android app: downloading data from the Internet and displaying it in a list. We will investigate the Model-View-Controller design pattern that is essential for all Android apps, learn how to request data from the web, parse and use information in JSON format, and utilize the built-in Android ListActivity and adapter. We'll also see how to display a webpage inside our app.

Build a Blog Reader Android App

5 Achievements

Exploring the Master-Detail Template

Exploring the Master-Detail Template

Included in Eclipse are a few Android project templates that can help us get started quickly with certain types of apps. In this stage we'll learn how the Master-Detail Template works, and we'll talk about the Model-View-Controller design pattern that is behind many Android applications.

0 of 11 Steps Complete
Rebuilding from Scratch

Rebuilding from Scratch

Using templates is great for getting started quickly, but to truly understand how to build something we should do it from scratch. In this stage we'll start with a blank project and use the Android system components for displaying data in a list. We'll see first-hand how to build the components of the Model-View-Controller pattern we talked about in the last stage.

0 of 8 Steps Complete
Getting Data from the Web

Getting Data from the Web

Now that we're comfortable displaying simple data in a ListView, let's take a look at how to connect to a website and request some data. This stage will cover how to establish that kind of connection and then use an AsyncTask in a separate thread of execution to retrieve data. We'll also see how to parse through the JSON data returned from the blog, and along the way we'll cover Java Exceptions and how to detect and handle them.

0 of 13 Steps Complete
Adapting Data for Display in a List

Adapting Data for Display in a List

Now that we've connected to the Treehouse Blog and retrieved data in JSON format, let's take a look at how to adapt that data for display in our ListView. We'll first adapt titles using an ArrayAdapter, we'll add some code to manage the user interface while our web request is running, add an AlertDialog in case of errors, and then we'll add author information using a more complex adapter called SimpleAdapter.

0 of 10 Steps Complete
Using Intents to Display and Share Posts

Using Intents to Display and Share Posts

Our list of blog posts looks nice and everything is working well behind the scenes, but nothing happens when the user taps on an item in the list. In this stage we'll add a listener for such a tap using the 'onListItemClick()' method and talk about a few different Intents we can use for different actions. First, we'll use an Intent to open the URL of the post in the browser, but then we'll add a second Activity to open the URL within our app and display it in a WebView. Finally we'll let users easily share the link however they want using the simple Share Intent.

0 of 8 Steps Complete

What you'll learn

  • Master-Detail project template
  • Model-View-Controller (MVC) design pattern
  • Displaying data in a list
  • Getting data from the Internet
  • Display a webpage inside an app

Instructor

  • Ben Jakuben

    Ben is a father, husband, son, friend, and teacher. He is firmly committed to the belief that the world is evolving to a better place. Find him on Twitter @benjakuben.

Download videos

You have to sign up for Treehouse in order to download course videos.

Sign up
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">