O'Reilly logo

Learning Android by Marko Gargenta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hello, World

To make sure everything is set up properly, we’re going to write a simple Hello World program. As a matter of fact, there’s not much for us to write, but a lot to understand. This is because Eclipse will create the project shell for us from some predefined templates.

Creating a New Project

In Eclipse, choose FileNewAndroid Project. Sometimes (especially the first time you run Eclipse) the Android tools may not be appear there right away. They should show up in the future after you’ve used them for the first time. If Android Project is not an option under FileNew, choose Other and look for Android Project in there. To run this application on the emulator, select the HelloWorld project in the Eclipse's Package Explorer window, right click on it, and choose Run As → Android Application.

In the new project dialog window, fill out the following:

  1. “Project name” is an Eclipse construct. Eclipse organizes everything into projects. A project name should be one word. I like to use the CamelCase naming convention here. Go ahead and type HelloWorld.

  2. Next, you need to choose the build target. The build target tells the build tools which version of the Android platform you are building for. In here you should see a list of available platforms and add-ons you have installed as part of your SDK. Go ahead and pick one of the newer ones, such as Android 2.2 (but don’t choose the targets named Google APIs—those are Google’s proprietary extensions to the Android platform). For our purposes, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required