Project

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.

Cover-android-blog-reader

5 Achievements

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.

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.

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.

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