Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
240 lines (188 sloc) 11.1 KB

Android Bootcamp

This project is designed as a learning tool to help get started developing Android, by creating a simple App.

This project contains a series of checkpoints. Each one is designed to build upon the last. You will learn:

  • Building interfaces using XML
  • Defining business logic using Activities
  • Communicating between Activities
  • Packaging and running an Application
  • Using background processes
  • Calling Web-services

Project Description

This project will build a simple expense tracker app.

The feature-set of this app is as follows:

  • Generate an Expense Item (With a desription and amount)
  • Use a Web-service to perform a currency conversion
  • Share the Expense Item
  • Save the Expense Item to the file-system


There are a lot of great resources available for learning Android development. Here are a few of the resources I used when I was starting (and still continue to use today).

Task #1 - Import Project

Checkpoint 1

Key Concept

Use the IDE to compile and run an Application

The purpose of this task it to familiarize yourself with the developer tools. For this task, you will import the project into your local IDE, and run the App on your device or an emulator.

The steps:
  1. Download and install the developer tools
  2. Import the Expense Tracker project into your workspace
  3. Create an emulator, or configure your device for development
  4. Run the app from your IDE

Task #2 - Modify user interface, and change Application name

Checkpoint 2

Key Concept

Learn how Android uses XML to define the user interface and String resources

The purpose of this task is to understand how Android uses XML files (in the /res folder of the project) to abstract interface definition, and other resources (like String values).

The steps:
  1. Change the title of the App from "Hello World" to "Expense Tracker"
  2. In the existing vertical LinearLayout, add the following Views
    • TextView
    • EditText
    • TextView
    • EditText
    • Button
  3. Remember to sure the text in your labels is not hard-coded

Task #3 - Additional Layout Concepts

Checkpoint 3

Key Concept

Explore additional layout containers, and use XML attributes to fine tune the interface

In this task, we will explore how to customize positioning and size of View components using XML attributes

The steps:
  1. Replace the existing LinearLayout with a RelativeLayout
  2. Change the 2 EditTexts to fill the screen (instead of currently expanding to size based on text input)
    • Expense Description
    • Expense Amount

Task #4 - Use Image Resources

Checkpoint 4

Key Concept

Understand how Android handles image resources to support multiple screen sizes

Because Android can support a large variety of devices (with many different screen resolutions), it is necessary to include multiple resolutions of any image you supply. This will insure they scale correctly on all devices.

The steps:
  1. Add a red arrow to the 'Enter' button to make it more visually appealing (Hint: Use Android Tools to create Icon assets)
  2. Extra Credit: add validation to the 'Amount' edit feild to ensure only numbers are entered (Hint: there is an inputType attribute)

Task #5 - Implement business logic with an Activity

Checkpoint 5

Key Concept

Use business logic to interact with interface elements

Android uses a Java Class (extending Activity) to execute business logic.

The steps:
  1. Get a reference to the 'Expense Amount' EditText, and retreive the value it contains
  2. Output the current value in the EditText when the button is pressed

Task #6 - Using Activity Intents

Checkpoint 6

Key Concept

Launch Activities using Intents

Android uses the concept of an 'Intent' to call start a new Activity from another.

The steps:
  1. Create a new Activity that will allow the user to record more information about the expense they are recording (named DetailActivity)
    • You will need to create a new XML layout and an Activity class
    • Don't forget to add your Activity to the AndroidManifest.xml file
  2. On the Main Activity, when the user presses the 'Enter Button' - launch the DetailActivity
    • The Detail Activity will be an opportunity for the user to add more details (and eventually save the expense to the filesystem)

Task #7 - The ActionBar

Checkpoint 7

Key Concept

Understand how the ActionBar is used

Android uses a control at the top of the screen for navigation, and user interactivity. It is useful to add buttons, and other information. There is a variety of functionality built into the ActionBar, that should be leveraged to ensure platform consistency

The steps:
  1. Add controls to the top of ActionBar of the DetailActivity
    • You will need to change the API level of our App, since the ActionBar was not supported until API 14
    • This will require new image assets for the menu icons (review Task #4)
  2. Add 2 new menu items that will eventually be used to email or share an expense item
    • You will need a new menu.xml file and changes to the Activity
  3. Extra Credit: Implement the Email action
  4. Extra Credit: Enable the Share item

Task #8 - Passing data between Activities

Checkpoint 8

Key Concept

Pass data between 2 Activities using Intent Extras

It is frequently necessary to include relevant data when starting one Activity from another. You can attach data to an Intent before sending it, which can be interpreted when the Activity starts.

The steps:
  1. Pass the current expense data from the MainActivity to the DetailsActivity
  2. Display expense information on the DetailsActivity
    • Extra Credit: format the currency amount in readable format

Task #9 - Accessing data from a Web Service (in the background)

Checkpoint 9

Key Concept

Accessing Web Services using AsyncTasks

It is common to interact with Web resources to get data. It is important to do this in the background, so the user doesn't experience pauses in the interface. This task will show how to access web resources off the UI thread.

The steps:
  1. Call a WebService to convert the expense value to a different currency
    • Make sure to call the WebService in an AsyncTask (off the UI thread)
  2. Log the output from the Web Service

Task #10 - Change the Interface when the AsyncTask finishes

Checkpoint 10

Key Concept

Understanding AsyncTask Life-cycle

Because we performed the Web Service call off the UI thread, we need communicate back with the interface to notify the user that results have returned.

The steps:
  1. Place the value returned from the WebService on the DetailActivity
    • During the appropriate lifecycle method of the AsyncTask, access the View object, and set the value
Jump to Line
Something went wrong with that request. Please try again.