Saturday, June 1, 2013

Create your first android application

I am not going to bore you with details like what is android and how it is better than other platforms etc. Since you have already decided to learn android, you have done your homework and got some introduction about these topics.

Let me instead start with what are the hardware and software you need to learn android.

Hardware
  1.  You need a PC. The OS does not matter. You can use windows machine, or Linux machine or mac.
 That's all. At this stage you do not need a phone running android.

Software 
  1. Since android applications are written in Java, you need a Java Development Kit. You can download this from oracle site http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. You need android software development kit (SDK). This can be downloaded from android developer website http://developer.android.com/sdk/index.html
  3. It is preferable to use an IDE. Eclipse is very convenient. You can download latest version of eclipse from http://www.eclipse.org/downloads/
Download these software and install them. And you are almost ready to learn android.

Do you have some basic knowledge of Java programming? If not, learn  Java now. Since android programs are written in Java, you need to know Java.

You will again ask me- what about emulator, where do I get emulator from. Android SDK comes with emulator and DDMS -Dalvik debug monitor server. 

Earlier it was necessary to download ADT - android developer tools, in eclipse IDE. But now android sdk comes bundled with ADT.

Once you install android sdk, you should decide which version of android - 4.2 Jelly Bean being the latest, you want to work on. Run SDK manager and download the corresponding sdk platform

You should download platform-tools and SDK platform form whichever version of android you want to use. It is advisable to download documentation which will help you in syntaxes.  Here I have selected android 4.0.3 to download and samples for the same.

Create  your first android application

You have armed yourself with all the tools necessary. Now plunge into water. Start eclipse and start a new android project

In Eclipse menu select File-New-Android Application Project.

In latest eclipse version, this is how the menu looks like


Change the application name and package name. In the next screen, select create Activity and create application in workspace. In third screen, select create blank activity and in fourth screen give activity name and xml name and click finish.
Your first android app is ready. Now build the project. Right click on the project name in project explorer and select run as android application. 
A new emulator is started and your app will be installed and executed in it. 



This is how your first app looks in android 4.2 emulator. Now grab a cuppa and enjoy. Because second lesson will not be this easy.

No comments:

Post a Comment