Learn How to Build an Android App
4.4 (22 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
5,104 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Learn How to Build an Android App to your Wishlist.

Add to Wishlist

Learn How to Build an Android App

Build an Android App in One Month
4.4 (22 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
5,104 students enrolled
Created by One Month
Last updated 8/2017
English [Auto-generated]
Current price: $10 Original price: $30 Discount: 67% off
5 hours left at this price!
30-Day Money-Back Guarantee
  • 5 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Build an Android App and debug java code
  • Understand the fundamentals of the Java programming language
  • Use the Android Studio IDE and run the Android Virtual Device emulator
  • Work with the Android SDK APIs and fetch data from a remote web server
View Curriculum
  • Students need some understanding of the basics of programming
  • Some understanding of Java
  • Fluency in English
  • Come self-driven and motivated to learn!

One Month Android is the best way to break into the world of Android App Development. Over the course of 30 days, instructor Alfie Hanssen (Director, Engineer, Mobile and TV Apps at Vimeo) will walk you through the process of building a brand new Android app. You'll put together a To-Do List app using Java and the Android Studio. At the end of the month you'll get a finished application you can use on your phone and a crash course in one of the biggest software platforms in the world!

Make sure you’re using a Mac with OSX 10.8.5 or above or a Microsoft computer running Windows® 8/7/Vista.

Please note that this is an advanced class - Alfie presumes that you will have at least a passing familiarity with the basics of programming and Java when you begin the class! 

Who is the target audience?
  • Anyone interested in learning Java, Android, and mobile app development
  • Intermediate programmers looking for a new project
  • Designers looking to expand their portfolios
  • Anyone with past struggles with the Android SDK
Students Who Viewed This Course Also Viewed
Curriculum For This Course
36 Lectures
Week 1
7 Lectures 46:38

Welcome to Android! If you're taking this course, you'll need to have both Java and Android Studio running on your computer. 

The goal of this first week is going to be learn the structure of an Android application and understand how the files interact with each other. It's gonna be fun. Promise.  

Preview 01:36

Once you're started your download of Android Studio, you can access the installation instructions.

Basically, you just need to make sure you have update versions of the JDK (J###/b Development Kit). To check if you have the correct version of the JDK installed, open a terminal and type javac -version. If the JDK is not available or the version is lower than version 6, download the ###a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html" class="external-link" data-mce-href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html">Java SE Development Kit 7.

Neither installation is very intensive. Follow the steps/setup wizards, and you'll be ready to go. For any additional tips you need, refer to the Android Studio site proper. 

Preview 06:30

A few notes about Android Studio: It's an integrated development environment (IDE), which means that it's software application that provides comprehensive facilities to computer programmers to - you guessed it - build software. Eclipse and IntelligiJ are both IDEs you may be familiar with from working with Java, but Android Studio works off of IntelliJ.  

For this first application, we're just going to run through the default setup of a new project. Once you have Android Studio open, simply select 'New Project.' Set the name and location; choose the default API (15, AKA Ice Cream Sandwich); and select the Blank Activity template. 

Activity here specifically means a mechanism that encapsulates a portion of the user interface on an Android device. The other word with special meaning is Fragments, and between them act as the building blocks for any Android UI. 

Once you have the project open, take a minute to explore the interface, and we'll start building in the next video. 

Preview 08:29

The first thing you should know when looking at your new Android project is that it's okay to be a little overwhelmed. Android is overwhelming, and even experienced developers do not interact with all of the features it offers. The first of a few discrete things we're going to be focusing on in this lesson is the Project Tab, here: 


This is your directory, more or less, where you'll be able to see your project's file structure. By double clicking, you'll open up individual files in the editor in a new tab on the right.


There's a couple things to keep in mind right out of the gate. Gradle is a build system which will help configure your project and allows you customization from outside plugins and libraries when you're ready to get fancy. But for now, just know that your project files are on the left, your editor on the right. 

To start up the Android Studio emulator, so that you can get a sense of what your app looks like on an Android device, you can go to the top of the toolbar and hit the green play button or press 'Command R.'  


The 'Run App' command will take you through the process of creating a virtual device. You can then choose both the device and operating system its running. Once your OS has installed and you've double checked to make sure you're satisfied with the options on your Android Virtual Device, or AVD, you'll be able to save your device and access via the Virtual Device Manager. You can get to it via the 'Tools', and then the Android tab. 


Once the emulator loads, you'll be able to see how the actual app corresponds side by side with your project. 




We start discussing in depth the various components of our Android activity - what goes where, what does what, and see changes reflected in the emulator. 

Hello? It's Me (An Activity)

Do some experimenting and play with the emulator a little to see what changes you can make and how they affect the activity. The Content.Main XML file, for instance, controls many of the layout options. You can add a line of text underneath the "Hello World" we added in the previous video by making the following changes: 

< TextView android:id="@+id/first" android:layout_width="wrap_content"xq android:layout_height="wrap_content" android:text="Hello World!" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="We're building an Android application!" />

The Main Event: Content.main

We quickly recap all the important features of Android Studio we've explored. 

The State of the Android
Week 2
13 Lectures 02:09:49

Before we get going adding complexity to the app, take some time to orient yourself - you can look at the directory in Finder and open up specific files in a text editor to see what's under the hood. 

A couple key terms: 

Java Files - control the functionality of the application. 

XML Files  - define the interface, or the visual elements put on screen. 

Don't Forget the Milk

The Github Repository for One Month has an Android To-Do List project that is the definitive working version of the project we're doing this week. Compare it to what you're writing as a guide or just a point of reference. You can also run it locally on your computer by downloading a zip file and opening it up in Android Studio. 

Getting Github

You can check and see what version of Android Studio you're running by going to the 'Android Studio' tab and hitting the 'About Android Studio' option. 

When you're setting up your New Project, make sure you select 'Phone And Tablet' and choose 'Minimum SDK, API 23 (Marshmallow).' While it targets a very small percentage of the devices active on the Google Play store, it's the best platform on which to learn the core concepts that are going to serve you in all of the other applications you build for whatever segment of the market you'd like to go after. 

Select "Add No Activity" for this project, and click finish. It may take a little bit of time to set up, but you should see the file directory come up in Finder and the primary Android Studio window come up. 

A Shiny New Project

  • Android SDK - a vast body of code available for you to make applications in Android. It's a toolbox of different functionalities you can take advantage of. Every single element, or tool, contained in the Android SDK also has a handy definition you can refer to if you get confused or are looking for something specific. And if you're confused about anything else, always feel free to Google or ask the community here at One Month. 
  • Activity - an application component, or a piece of user interface, which the user can interact with and is displayed onscreen.  So the list piece of our To Do List is an activity. 

So to build the first activity, select the directory inside the Java directory, and create a New Java Class. 


It's important to note that whatever class of activity you create is imported from the Android SDK. You'll also need here to create a layout file to along with your Java file, which can be created by clicking "Res" or resources, and choosing a New Resource Directory. 


The point of all of this is to create the spaces to write our code so that our application not only looks but also behaves the way we want it to. We do this specifically by coupling an XML file with a Java file. The Java file will control the functionality, behavior, and user interaction with the XML file, which defines the application's visuals. Think of it like Star Wars: 

 We'll write our code in Java in order to manipulate the XML. 

What Activity To Do First?

If an activity is a piece of the interface the user can interact with, how does it respond to interaction like scrolling or tapping a button? User changes trigger changes in the activity, so it has what's called a lifecycle - based on what the user does, activities can be created, destroyed, paused, or resumed. One of the most important methods of controlling that lifecycle is the one that's going to also link our Java with our XML: onCreate( ), or what happens upon that activity being activated. And the first thing that should happen is the activity should load up it's accompanying XML file.

You can like them like so:  

public class MainActivity extends Activity{  @Override protected void onCreate(Bundle SavedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }}

Now, when we generated our XML file, it was as a relative layout. In the most basic terms, a relative layout is a view, or a visual structure for a user interface, that also contains other views, and organizes them with respect to one another. You can add myriad attributes to that layout, but for now your code should look like this: 

<?xml version="1.0" encoding="uts-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="16dp" android:paddingBottom="16dp"> </RelativeLayout>

A Method (Stub) To The Madness

The Android Manifest defines the application's setting and configurations. Any time you create an activity, you want to register it in the manifest.

For this activity you want to specify that it's the Main Activity that opens when the application is opened. This is done through an <intent-filter>. The code should look like this: 

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.onemonth.todolist" <application   android:allowBackup="true"   android:icon="@mipmap/ic_launcher"   android:label="@string/app_name"   android:supportsRtl="true"   android:theme="@style/AppTheme">      <activity android:name=".MainActivity"     android:label="@string/app_name"       <intent-filter>       <action android:name="android.intent.action.MAIN" />       <category android:name="android.intent.category.LAUNCHER" />       </intent-filter>      </activity>

Once you've done this, you can test it through the Android Virtual Device. You shouldn't see much besides a white screen, but that is a canvas on which we'll be able to build all our application's functionality. 

Manifest Destiny

The first step to creating our toolbar is in going to the Styles XML file which can be found under "Res" and "Values." Remove the bottom three items, and change the style tag from the default setting, which you can see commented out, to the following: 

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="android:Theme.Material.Light">    <!--<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">-->   </style></resources> 

And the voila. That parent attribute adds a toolbar which displays our application's name. To change the name, you can go into the manifest. Based on what we've done so far, both the main label and the Main Activity name label read as "@string/app_name" That's XML's way of telling the application that the information it needs is in Strings XML file, with the title of "app_name."  Like so:



So in the String XML file, you can change what "app_name" represents to any name you'd like. It will then be automatically changed and reflected wherever it's referenced in the manifest. 

Raise The (Tool)Bar

view is simply a collection of pixels that are located on screen. You can customize them, you can animate them, you can have the user interact with them, but they're a collection of pixels designed to do a certain thing. 

So on top of the blank canvas of our application, there can be any number of views. We control how the user interacts with them - what the user sees and when - through our view hierarchy. The hierarchy is composed through the stacks of views you layer on top of one another and together represent the whole of your application. 

The view that we want to work with in particular for this Really Cool List is a listview. The listview isn't the same as a pad of lined notepaper, though. It actually manages individual item views - think each line on a notepad - and controls what displays on screen as a user scrolls up or down. Those individual item views, by the way, are going to be strings, or a sequence of characters that probably form a word or words; though, who knows? Maybe Plrtz Glrb is something you really have to get done this week. 

How does the listview work? Mostly through an Adaptor. The adaptor holds the array of strings, or the number and order of items, within the list. It communicates with the listview, providing new strings as the listview asks for them.Basically, the adaptor is your list manager, while the listview is the frontman the user actually sees. So to build a working list, we need both. 

Early Adaptors

The first step in adding a listview is to, well, add a listview into the activity.main XML file. It should look like this: 

  <ListView      android:id"@+id/activity_main_listview"      android:layout_width="match_parent"     android:layout_height="match_parent"></ListView> 

Pay attention to the proper nomenclature as you work. Notice the construction of the id tag includes the @+id/ prefix. 

The next step is to create a new layout resource file that manages list items. The root element should populate as a linear layout, name it list_item, and it should generate fairly quickly. Once there, the point is to create a view that's able to hold a string of text because that's what each list item should be able to do. Feel free to browse the Android Developer site for more customization options, bells, and whistles, but the basic code should look like this: 

<TextView    android:layout_width="match_parent"   android:layout_height="wrap_content"   android:layout_gravity="top|start"   android:textSize="14sp"   android:maxLines="1"   android:ellipsize="end"   android:typeface="sans" />

The next step is to go back into the Java file and add the listview XML into the Java so that it's both visible in the app and able to do all the wonderful listy things we want it to do. That could should look like this: 

ListView listView = (ListView) findViewById(R.id.activity_main_listview);listView.setAdapter(adapter); 

Next, we'll work on putting together the adaptor. 

You Can't Always List What You Want

First thing's first, go back into your List Item XML file and add an identifier tag, so that it can be recognized by the Java. 

<TextView    android:id="@+id/list_item_textview"   android:layout_width="match_parent"   android:layout_height="wrap_content"   android:layout_gravity="top|start"   android:textSize="14sp"   android:maxLines="1"   android:ellipsize="end"   android:typeface="sans" />

There are several components to creating an adaptor. The first is the constructor method, which is the function that creates a new string adaptor. The second we're going to worry about is the method that configures the list item, and overrides the method 'get view.'  

If you're confused about any of the terminology of 'argument' 'function' or 'method,' then definitely read through what the Android development and Java documentation pages have to say to get your bearings. 

The next piece of the puzzle is to actually create a Java file for the adaptor, by adding a new Java Class below the main activity. Once we've done that, we can build our constuctor. Your code should look like this: 

package com.onemonth.todolist; import android.view.LayoutInflater; import android.widget.ArrayAdapter; import android.content.Context; import java.util.List; import java.util.ArrayList;   public class StringAdapter extends ArrayAdapter<String>   {     private int mResource;     private int mTextViewResource;     private LayoutInflate mLayoutInflater;     private List<String> mItem = new ArrayList<string>();     public StringAdapter(Context context, int resource, int textViewResource)       super(context, resource, textViewResource);       mResource = resource;       mTextViewResource = textViewResource;       mLayoutInflater = (LayoutInflater)context.getSystemService(context.LAYOUT_INFLATER_SERVICE); }

The constructor takes a couple different arguments, instances or objects it has to account for. The Layout Inflater is a tool that converts, or inflates, views that are defined by XML files into objects that can be manipulated by code. All this is working to allow the information about the constructor, ie. our list, to be accessed through Java, which allows the constructor to invoked dynamically, ie. when the user wants. 

The next step is to go back to the main activity file and register our new java files there, so that as soon as the application starts, the listview will be both visible and functional. The code should look like this: 

public class MainActivity extends Activity{   private String Adapter mAdapter;    @Override   protected void onCreate(Bundle SavedInstanceState)   {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main);     mAdapter = new StringAdapter(this, R.layout.list_item, R.id.list_item_textview);     Listview listview = (ListView) findViewById(R.id.activity_main_listview);     listView.setAdapter(adapter);  }}

And at this point, the adaptor is half set. What's left is to create the functionality that will allow the adaptor to talk to the listview whenever the listview asks. 

Under Constructor

The final step in creating our adaptor is to override the get view method so that instead the contents of the listview can be displayed dynamically, aka at the user's whim. 

The code should look like this:

@Overridepublic int getCount() {   return super.getCount();}@Overridepublic View getView(int position, View convertView, ViewGroup patent){   if (convertView == null)   {     convertView = mLayoutInflater.inflate(mResource, null);   }   TextView textView = (TextView) convertView.findViewById(mTextViewResouce);   String item = mItems.get(position);   textView.setText(item);   return convertView; }

What this does is give the listview to the two key pieces of information it needs to display a list: how many items are in the list (this is your return super.getCount, which tells the app to populate as many items as there are in the list) and what those items are (this is your mItems, which displays all the items added in). The layout inflater also works in the function above to initially populate the list. 

Now, at this point, we've only manually added dummy data so that the list is viewable. Adding and storing data through the application is on the horizon, but don't worry about it here. 

Tip: You can command + click on pretty much any class and it will jump you to that class in a new tab, where you can read documentation about said class and what's involved with them.

The Perfect GetView

The things that we've done so far to build our activity: 

  1. Created a Main Activity. 
  2. Created a list with some dummy data. 
  3. Created an adaptor and a listview to render all the list information dynamically onscreen. 
  4. Learned that a listview manages a bunch of subviews, aka each item on the list, and efficiently displays them through performance scrolling. 

How we would describe the process of creating a pretty reliable, essential component for Android application development: 

  1. Awesome. 

What Have You Done?

Get Stuck in a Viewholding Pattern
Week 3
11 Lectures 01:25:41

It's time to add the ability to insert items, and we're going to do this through a FAB, or Floating Action Button. So we need to add the Fab so that it creates a second activity subclass, creating a whole new screen that will allow the user to input text into a field.

The second activity then needs to be able to send what was entered into the text field to the main activity and have it be inputted into our list. So our activities need to do exactly what they're designed to do, and be able to speak to each other.

What does this entail? A new java file, a new XML file, and also associated XML files as necessary. Get excited. 

FABulous UX

Top Tip: Any time you edit the build.gradle file you may be prompted and you absolutely should sync the project. Otherwise, you won't be able to take advantage of anything you've added. 

The Design Support Library is the place where the Floating Action Button is supported, so we need to add it in order to add the FAB. Here's what it should look like when we add the design support library: 

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.0.1'}

After syncing our edits, from there we can head to the Main Activity and the FAB should come up when prompted. 

Support Your Local Design Library

We don't exactly plant seeds in the ground, but we create a bunch of XML code to define the parameters of our floating action button. 

Xtreme XML

One step closer to creating the Floating Action Button, one more trip back to our old friend, Activity.Main. 

Almost FABmous

We begin creating functionality for our FAB. Or at least, that's the plan. 

Fatal Exception

Alfie gives you a quick note on how to straighten and pad out the lines of our list, so they look ruler perfect. 

And Now For Something Completely Shorter

We create a text field in our FAB activity and put some of the pieces in place to add that into our To-Do List. 

Playing The (Text) Field

Do you save regularly? We're about to be able to once we add a Save Action to our FAB activity. 

Order Off The Menu

We begin the process of saving our text and passing it to the Really Cool List. 

Get To The Save Point 1: Constants And Context

We continue our great item text caper, capturing the information from our Add Item Activity and logging it with our Main Activity. Stay tuned for the thrilling conclusion. 

Get To The Save Point 2: Console Counsel

This week's grand finale, in which we take the items captured by the Add Item Activity, pass them to our Main Activity, and add them to our to-do list. 

Alfie's List
Week 4
5 Lectures 42:34

We build in the ability for uses to delete items from our to-do list. 

Control All Deletes

Now that we have a functioning to-do list, it's time to teach our application to remember information across sessions. 

Cache in the Bank

In order to save and load our items, and particularly across app sessions, we use the Android SDK SharedPreferences, which, basically, can handle certain kinds of data. This means we need to employ a third party (~ish, it's Google so it's in the family) library called Gson.

Gson is Google's take on Json, or JavaScript Object Notation. Gson allows us to convert our array of information into a single string, and then extract that string back into an array when, just for instance, the application is loaded and the cache is called upon to give the Main Activity a list of items. Sound good? 

It's On With Gson

We finish up setting up Gson and set the application up to load saved items when launched. 

Loading (Data), Ready, Run

Congratulations! You've made it all the way through. While the Really Cool List we built isn't much beyond

  1. A list, and - 
  2. Cool. Really.

- you've learned the key concepts that will allow you to scale more complex applications through Android Studio. You understand the relationship between Java and XML in Android, understood the manifest file, and how all three communicate with each other. You looked at Android SDK, the gradle build system, and how to include third party dependencies, and learned how to test applications through the virtual device emulator and the de-bugger.

That, to use a technical term, is a lot. Keep processing these concepts, keep sharing your results and asking questions in the community, keep googling and reading, and keep building your familiarity with code. Eventually, only limitation of what you can build in Android will be your ability to come up with ideas. 

Anatomy of an Android App
About the Instructor
One Month
4.4 Average rating
376 Reviews
18,419 Students
8 Courses
Learn Anything In a Month

One Month is an online teaching company started by two Columbia University professors. The platform provides tutorials for entrepreneurs and programmers, including One Month Rails, Project & Product Management, Ruby, Python, HTML, React, Programming for Non-Programmers, and more. The company's name comes from courses that are designed to teach a programming language in 30 days. The company has had over 50,000 users, including employees of Google, Bloomberg L.P., Singularity University and the School of Visual Arts in New York City.