SIGN UP MEMBER LOGIN:    
ARTICLE

Getting Started with Android Application Development

Posted by Dipal Choksi Articles | Android Programming December 26, 2011
In this article we will learn how to get started developing Android applications. We will walk through the steps to setup your environment and then create a sample application.
Reader Level:

Introduction

In this article we will learn how to get started developing Android applications. We will walk through the steps to setup your environment and then create a sample application.

What do I need to get started

To develop Android applications, you need to install the Java Development Platform (JDK) and then install Eclipse, Android SDK and the Android Development tool plugin for Eclipse. All these tools are available for free.

Another option is to use Mono for Android: http://xamarin.com/monoforandroid

This tool allows you to use either the Visual Studio IDE or use the MonoDevelop IDE to create applications. It also facilitates installing the Android SDK. This is ideal for developers already in the .Net resource pool. They can leverage the familiar environment and tools to build Android apps thus shortening the learning curve. However, it also comes attached with a price tag. For pricing/licensing/additional info, you can reference the xamarin web site.

Since I have started looking into Android development at a hobbyist level, a good starting point for me was to leverage the free tools. I also wanted to figure out how different Android programming using the native tools was, through the eyes of a .Net developer.

So, here we go dipping into the Android waters :)

Step 1 : get the JDK - http://www.oracle.com/technetwork/java/javase/downloads/index.html and install it

Step 2 : get the Eclipse IDE - http://www.eclipse.org/downloads/

Step 3 : get the Android SDK starter package.

Step 4 : Install the Eclipse ADT plug-in: Within Eclipse, click Help -> Install New Software. Click "Add". In the Add Repository dialog box, enter "ADT plugin" for the Name and specify the Location URL: https://dl-ssl.google.com/android/eclipse/

If you get any errors after clicking OK, try using https in the above URL. I had some trouble at this point and kept getting an error message. Old friend google came up with several suggestions related to firewall issues etc. The solution was ultimately found on the Android developer site (http://developer.android.com/sdk/eclipse-adt.html#installing) to download the ADT plugin and save it locally (not unzip it) and then in the Add Site dialog, click Archive and select the downloaded archive. voila!

Step 5 : Install the Android platforms that you wish to develop against. Run the Android SDK and AVD manager and within the Available Packages menu select the platforms that you wish to download.

This is where I had hit a speed bump. I would get a connection error when the SDK and AVD manager tried to fetch the Available packages. I tried various options for firewall settings, http vs https setting as well as running the program as administrator. None of these solutions worked for me. Finally the step that I had to take as a workaround was to download the platforms directly and install the packages manually offline. Here is the best resource that I could find on getting this setup work.

Download Android SDK standalone for offline installation

http://qdevarena.blogspot.com/2010/05/download-android-sdk-standalone-for.html

Step 6 : Create a new Android virtual device - From the Android Virtual Device Manager (AVD). click the new button and select the configuration for the virtual device.

Let the coding begin

At this point I had a working environment and I hope some of the real life issue described above might help someone running into the same issues.

So we are at a stage when we can begin the coding. We start with a simple "Hello world" type program just to get the components running together to see how the end result looks like.

Start the Eclipse editor and select a default workspace. Click on File-New Android Project and enter the name for your project. I used the name "HelloWorld".


and01.jpg

Image: Create New Project

Next select the target platform. I have selected Android 2.2 for this example.

and02.jpg

Image: Select the platform

Next we provide the project configurations. Feel free to modify the settings as needed.

Add the code as follows within the java source file (HelloWorldActivity.java)

Source code

package com.android.HelloWorld01;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
 
public class HelloWorld01Activity extends Activity {
     /** Called when the activity is first created. */
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         TextView tvHello = new TextView(this);
         tvHello.setText("Hello Android World");
         setContentView(tvHello);
    }
}

Now run the application.. If prompted, select to run the application as an Android app.

and03.jpg

Image: The application running in the emulator

Conclusion

We walked through the entire setup of development environment for Android applications. We also took a look at the practical issues that one might run into, through the setup steps. Finally, we stepped through a Hello World program sample. We can now explore the vast features available for custom app development on the android platform.

Happy Coding!

Login to add your contents and source code to this article
share this article :
post comment
 

Just what i needed...thanks

Posted by sasheet kripalani May 16, 2012

Thanks for the feedback comments!

Posted by Dipal Choksi Dec 28, 2011

good Efforts Dipal

Posted by Alten Chingumbra Dec 28, 2011

Nice article.

Posted by Chintan Rathod Dec 27, 2011

I need this overview about the application development in Android..Thanks

Posted by Akash Ahlawat Dec 27, 2011
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor