Click here to Skip to main content
15,879,095 members
Articles / Mobile Apps / Android

Creating a Simple Hello World Android Project

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
5 Aug 2014CPOL3 min read 23.8K   9   17
In this tutorial I will explain about the basic components of an Android application and show you step by step how to create, fix, and test your first android application.

Introduction

This step by step guild is packed full of screen shots to guide you in the journey of creating a simple Hello World application. Ready to code?

Background

This tutorial was made using Windows 8, Eclipse Platform 4.2.2 and the Android ADK 23.0.2.1259578.

Lets learn...

Step 1: Definitions and Basic Components

Minimum SDK = This is how far back you wish to go in regards to the Android OS.

  • You want the minimum SDK to go as far back as possible. Keep in mind if your application uses something introduced into the Android OS version 4.0 or higher, then your minimum needs to be 4.0.

Target SDK = Is the Android OS you have in mind for developing this application

Compile With SDK = Is recommended to be set to the most recent stable SDK in the market.

  • For this you will want to set the compile with SDK to the highest stable Android OS. This is so that your target audience can still use your application if the receive an Android OS update.

The Basic Components are...

Image 1

Resources...

Image 2

Step 2: Launch Eclipse

Image 3

Step 3: Create Project

Image 4

Image 5

Image 6

You can use this public domain image for the next step.

Image 7

Image 8

Image 9

Image 10

Image 11

Step 3: Review and Update your application

Image 12

Lets find out why...

Image 13

Lets fix it....

Image 14

Image 15

Image 16

Image 17

You could also change the theme to something compatible or create a custom theme using styles, if you prefer.

Image 18

Image 19

Image 20

Image 21

The Graphical Layout tab gives you an idea of what the user will see. There are widget tools you can use to create your layout and GUI interface by dragging the items onto the screen.

Image 22

Image 23

Image 24

Image 25

Image 26

If you go back to the Graphical Layout tab you will see the string we added string now shows in the GUI layout.

Image 27

Step 4: prepare the first test

Image 28

Image 29

Now enter two more like these to represent Android 4.2.2. Then enter one to represents Android 4.4.2 and an extra large screen.

Image 30

Image 31

Image 32

Image 33

Image 34

Image 35

Step 5: Test on Virtual Android Devices

Image 36

Image 37

Image 38

Image 39Image 40

Image 41

Image 42

API 14 Looks good..

Repeat the above steps for AVD Android 4.2.2

Image 43

Image 44

API 17 Looks good.

Repeat the above steps for AVD Android 4.4.2

Image 45

Image 46

API 19 Looks good...

Step 6: Test on actual Android Devices

Make sure your device has USB Debugging checked in Developer Options, located in Settings. Then plug your android device into your PC or Laptop using its USB cable.

Image 47

Image 48

View HelloWorld in both Portrait and Landscape.

Image 49

Portrait looks good...

Image 50

Landscape looks good...

Run HelloWorld for one hour to see how the application effects the battery level of your device.

Before for instance, record the starting level. Mine is at 100%.

Image 51

Run HelloWorld and leave it running.

Image 52

One hour later, close HelloWorld. Record the level, mine is 97%.

Image 53

Looks good... No significant loss of battery.

The End!

Points of Interest

While creating this tutorial, I actually started with API 8 and was not aware at the time that my theme selection was incompatible. I had to decide whether to keep the error and fix it in the tutorial, or start over. I decided that I would rather use it as an opportunity to teach the user how to look for and fix this type of issue.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks for the entry! Pin
Kevin Priddle12-Aug-14 8:52
professionalKevin Priddle12-Aug-14 8:52 
GeneralRe: Thanks for the entry! Pin
Julie Bartolf24-Aug-14 8:53
Julie Bartolf24-Aug-14 8:53 
Questionhello,I am not clear with this... Pin
cjzsm7-Aug-14 21:23
cjzsm7-Aug-14 21:23 
AnswerRe: hello,I am not clear with this... Pin
Julie Bartolf24-Aug-14 8:59
Julie Bartolf24-Aug-14 8:59 
SuggestionSuggestion Pin
Ranjan.D3-Aug-14 5:28
professionalRanjan.D3-Aug-14 5:28 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 6:58
Julie Bartolf5-Aug-14 6:58 
GeneralRe: Suggestion Pin
Ranjan.D5-Aug-14 7:06
professionalRanjan.D5-Aug-14 7:06 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 7:28
Julie Bartolf5-Aug-14 7:28 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 7:43
Julie Bartolf5-Aug-14 7:43 
GeneralRe: Suggestion Pin
Ranjan.D5-Aug-14 8:17
professionalRanjan.D5-Aug-14 8:17 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 9:26
Julie Bartolf5-Aug-14 9:26 
GeneralRe: Suggestion Pin
Ranjan.D5-Aug-14 9:35
professionalRanjan.D5-Aug-14 9:35 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 9:43
Julie Bartolf5-Aug-14 9:43 
GeneralRe: Suggestion Pin
Ranjan.D5-Aug-14 10:12
professionalRanjan.D5-Aug-14 10:12 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 10:18
Julie Bartolf5-Aug-14 10:18 
GeneralRe: Suggestion Pin
Ranjan.D5-Aug-14 10:28
professionalRanjan.D5-Aug-14 10:28 
GeneralRe: Suggestion Pin
Julie Bartolf5-Aug-14 8:01
Julie Bartolf5-Aug-14 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.