Site icon Treehouse Blog

The Beginner’s Guide to Android

The Beginner's Guide to Android

If you ask someone what an iPhone is, the answer is pretty obvious, and even people unfamiliar with iPhones are likely to be able to tell you pretty accurately what it is. But if you ask, “What’s an Android?” you are likely to get a more diverse set of answers. Many people will be able to tell you it’s a smartphone, but where does it go from there? Who makes the phone? How big is it? Are you talking about smartphones, or a robot that looks and acts like a human?

All About Android

What is Android?

“Android” specifically refers to a mobile operating system (based on Linux) that is developed by Google.  It is open-source software, meaning that anyone can download the source code and use or modify it.  Hardware manufacturers often take the base Android code and then add their own proprietary software features to it to run on their own phones.

Is Android just for Phones?

Android doesn’t just refer to smartphones, though most people probably think of them first.

Definitely not!  There are more and more Android tablets on the market, like the Nexus 7 and the Kindle Fire from Amazon.  But Android can run on all sorts of devices, from cameras to game consoles to car systems to glasses!

As for phones, Android users can pick the device that’s just right for them.  Budget-conscious users can often find free Android phones with pay-as-you-go service, or gadget freaks like myself can opt for large, high-end phones like Samsung’s S3 or Galaxy Note 2. What’s more, if you don’t like how the operating system on your phone is configured, you can always overwrite it with a custom version like the popular CyanogenMod ROMs for Android phones.

What can Android devices do?

The hardware features will vary depending on the type of device it’s running on, but the Android operating system provides support for cameras, GPS location, Bluetooth, Near-Field Communication (NFC), accelerometers, compasses, gyroscopes, and more!

The Android operating system features software components like live wallpapers and widgets, a powerful notification tray to help you keep track of important updates, voice typing, and seamless app integration, which allows users to easily share information via social networking apps or other forms of communication, like NFC.

All About Android Development

As the number one mobile operating system in the world, Android devices are used by more people than any other type of mobile device.  This gives developers a great opportunity to develop apps that can potentially be used by hundreds of millions of people.  Getting started with Android development might seem a little overwhelming, but our mission at Treehouse is to make it approachable and fun. Take a look at the Build a Simple Android App project if you want some step-by-step instructions on how to get started, but read on for more details.

Every major release of Android has had a food-related code name, and a statue to commemorate each is visible at Google HQ*.

What languages can I use to write apps for Android?

Android apps are typically written in a programming language called Java.  Java is immensely popular, and as an object-oriented language, it’s easy to pick up if you’ve worked with other object-oriented languages like C#, Objective-C, or Ruby.

Google also provides a Native Development Kit (NDK) that allows developers to write important parts of their apps with native languages like C or C++.  This can be helpful if you need to reuse existing code or libraries in those languages, or if you want to try to get as best performance as possible for your app.

There are some tools that allow you to write apps using web languages like HTML, CSS, and JavaScript.  You can either write apps that run inside something called a WebView, meaning that it’s a full-fledged web page that runs inside an app instead of a browser, or you can use tools like PhoneGap or Appcelerator Titanium to write code that compiles down to native code behind the scenes.  There are pros and cons to taking this approach. In general you will get the best results by using a native language like Java, but you can certainly make solid apps that can delight your users with whatever tool you choose.

If you really love another programming language, you can use some 3rd party tools to write apps in that language, though these will always lag behind the latest features that get rolled out with each Android update:

How do I get started developing apps for Android?

If you follow the recommended approach and want to write an app using Java, then the easiest way to get started is to grab one of the Android development bundles provided by Treehouse. Check out Stage 1 of Build an Android Crystal Ball App.  Specifically, go to the page for the video Android Setup and the Crystal Ball Project and select the bundle that corresponds to your operating system from the Download links below the video.  Unzip the bundle, run the “initial_setup” script, and start coding!

The Android Developer site also has extensive documentation about how to get started, how to design an app for Android, and details about all the Application Programming Interfaces (APIs) available.  The Android development tools are available for Windows, OSX, and Linux, so you don’t need to buy any additional hardware to develop Android apps.

It’s not completely straightforward to set up your computer for Android development, but it’s not terribly difficult, either.  The basic steps are:

  1. Install Java on your computer (though it may very well already be installed).
  2. Install the Android SDK.
  3. Install Eclipse, the Integrated Development Environment (IDE) recommended for Android development.
  4. Install the Android Development Tools (ADT) plugin for Eclipse.
  5. Download the rest of the required SDK components from the SDK Manager inside Eclipse.

How much does it cost to develop apps for Android?

It’s totally free to start developing apps for Android!  The Android SDK includes an emulator that acts as a real Android device right on your computer, so you don’t even need a phone or tablet.  All the tools listed above are free, so all you really need is a computer, an internet connection, and some time!  If you fully develop an app and eventually want to publish it on Google Play, then you will need to pay a one-time registration fee of $25.

My Recommendations

There certainly is no right way to go about developing apps for Android, but in my experience it is worth following Google’s recommendations.  One of the biggest benefits I haven’t mentioned yet is the ever-expanding community of Android developers, the bulk of which are using Java and Eclipse to write their apps.  If you get stuck, resources like Treehouse and StackOverflow are available with large user communities for support, and in true open-source fashion, there are a number of incredibly useful libraries and tools available to use in your development.

If you’re turned off by Java as a programming language, just know that Java for Android is much different than the Java of yore for big, complex, enterprise systems or even programming classes in high school or college. Having written apps for Android, iOS, and the web, it’s not the language that matters as much as the tools and resources for it. Don’t let the language get in the way, and learning another language will only help you become a better programmer (unless it’s LISP).

Start with some nice tutorials from Google or (one last shameless plug) Treehouse that walk you through some basics and don’t worry about remembering or even comprehending every detail. Just try to absorb what you can from the experience so that you can start to put all the pieces together when you start to work on your own projects.

Then pick a simple project that covers some of the things you think you are interested in and will need to use a lot. After going through some of the tutorials on the Android developer site when I first started, I then wrote a very simple app to input a search term with a text box (EditText), query Google, and then parse the results to display them in a list on a separate page (Activity).  For me this helped me understand the overall app architecture, how to record data from the user, how to send data over the web and retrieve results, how to parse results into meaningful data structures, and how to navigate from one screen to the next with shared data components.

If you are the kind of person who likes to learn from the dead-tree medium, then I would recommend Professional Android 4 Application Development by Reto Meier or the forthcoming Android Programming: The Big Nerd Ranch Guide by Brian Hardy and Bill Phillips. Both books cover most aspects of Android development and give you some fun and useful projects to work through.

What’s next?

The first Android device, the HTC Dream, was released in October 2008. Android is still relatively new, but it quickly rose to become the most popular platform for smartphones and has rapidly matured and evolved. It’s exciting to think about what the future holds for Android devices and developers. The world is going mobile, and now is the perfect time to learn how to write your own apps!

*Google HQ image courtesy of nasaldemons under the Creative Commons license.

Exit mobile version