Saturday, 4 January 2014

Android Hello World Example



In this tutorial, you will learn how to get started with android application development. You will learn how to create a simple hello world Android Project using Eclipse IDE and ADT Plugin. The Android Project will be run using Android Virtual Device (AVD). 

The Eclipse ADT plugin provides easy project creation and management. You can easily drag and drop the components. The auto-complete feature of the Eclipse IDE will help you write code faster and more accurate which is less prone to errors.

All this information will help you understand the Android Application Development Cycle.

Steps to follow:

  1. Install Android SDK
  2. Install ADT Eclipse plugin
  3. Create an Android Virtual Device (AVD)
  4. Create Android Project with Eclipse (Wizard)
  5. Write Code
  6. Run your application in Android Virtual Device (AVD)

1. Install Android SDK

Go to Get the Android SDK page and download the SDK bundle specific to your platform (Windows, Macintosh, Linux | 32 or bit)

In Android SDK installed folder, run Android SDK manager. Now choose what Android version you want to develop applications for.


Android SDK Manager +Maven Scientists 

2. Install ADT Eclipse Plugin

The ADT Eclipse Plugin is required to integrate Android SDK with Eclipse IDE.
You can also refer to the official android guide – Installing the ADT Plugin

To install the ADT Eclipse Plugin
In Eclipse IDE, select Help, then click on Install New Software.

Now, put the following url 
https://dl-ssl.google.com/android/eclipse/

ADT Plugin for Eclipse IDE +Maven Scientists 
Note: In case you are facing any problem regarding ADT Plugin installation, you may refer this official troubleshooting guide

3. Create an Android Virtual Device

In Eclipse, you can open the Android Virtual Device (AVD) in Eclipse toolbar. Click new to create an AVD.

Android Virtual Device +Maven Scientists 
Later on, when you develop application in Eclipse IDE, you will use AVD to deploy and test your applications.

4. Create Android Project with Eclipse (Wizard)

In Eclipse, select File -> New -> Project, Android Project, and input your application details. Eclipse will create all the necessary Android project files and configuration.

Android Project Structure +Maven Scientists 

5. Write Code

Automatically the main activity of the application (MainActivity.java) will open and you are ready to edit the java code.

Additionally, the MainActivity.xml file also opens and you can check the graphical layout and the xml code for the main activity.xml

Note: The xml file is generally used to design the user interface and the java coding is used to give the functionality to the user interface.

You will notice that by default, hello world is written in the xml file.

Main Activity.java +Maven Scientists 

6. Run your application in Android Virtual Device (AVD)

Right Click on the Project Name in Project Explorer. Now, click on Run As > Android Application.

You will notice that the application opens up the Android Virtual Device (AVD) that you have set up and display the following.

AVD Running Hello World Application +Maven Scientists 

Note:  If you are starting the AVD for the first time, then it is natural for AVD to take quite some time to start.

When you click on the menu icon in AVD, you will see all the applications installed in your AVD. From now on, the applications that you create in future will also be seen here.

Menu displaying Hello world Application in AVD +Maven Scientists 




Get Ebooks delivered to your email id

Comments

Subscribe to our channel

Facebook

Powered by Blogger.

Home | Contact Us | DMCA | Terms of Service | Privacy | Advertise

Maven Scientists