How to Program Android Apps

Right now, Android is world’s second biggest Mobile OS and Android market is, off course; the biggest Apps Market in the world. Yups, its biggest, with 500,000+ Android Apps. Days of Apple’s App Store are now gone. Now it’s second one. So being a developer for world’s biggest App market can not only give you name and fame, but also a lot of money. But for all of that, you must be a good Android Dev.

So what are you waiting for? Start your Android Dev journey today by developing your first Android App. Here I am providing you a step-by-step guide on how you can easily make your own Android App. So keep reading:

First of all, I want to tell you a little bit about Android Apps. Android Apps ( just like any other mobile app) are built on a PC or Mac. Generally, but not always. They’re written in Java – a relatively easy to learn, friendly language for newbie developers. Then after designing and developing, they are compiled and sent to the device for testing. Not have an Android Device? Don’t feel bad my friend. Because for developers who don’t own an Android device, there are emulators that simulate an Android device on your computer. It means that you can still develop an Android game or application.

Now the tale comes to steps. So given below are 10 easy steps for developing your app. Read them, follow them, and build your own Android app today.

Step 1: Get Eclipse (if you don’t have)

For this guide, I’m going to use Eclipse. That’s because Eclipse is the undisputed easiest and most hassle-free development tool for Android right now. NetBeans programmers, please be my guests. But for this guide, I’m going to play with Eclipse.

I wanna tell you that the downloaded file will be a .zip file and when you’ll unpack it, you’ll be able to directly run it in the directory in which you unpacked it. There’s NOT any installer for INSTALLING IT LIKE A SOFTWARE.

Step 2: Get Java JDK (if you don’t have)

If you don’t have then download Java JDK 6 now. It’s okay if you’ve Java JDK 5, but there’s no reason for not upgrading to 6. So you need to have at least Java JDK 5 for completing this guide. If you don’t have then get it now.

Step 3: Get Android SDK Tools

Now you’ll need Android SDK Tools. Unpack them, and install them in a directory. If you already have Android SDK Tools, then you can skip this step and proceed to next step easily.

Step 4: Configure Eclipse for your Android

Start Eclipse, and proceed to ‘Help>Install New Software‘. Hit  “Add…” and for the name, type “Android” and set the link to “https://dl-ssl.google.com/android/eclipse/”. If this doesn’t work, try it with http:// instead of https://).Click “OK” and the following should appear.

Select both resulting packages and click on Next button. This will download ADT (Android Development Tools). After downloading, restart Eclipse.

Step 5: Configure Android SDK

Go to the directory in which you downloaded/unpacked Android SDK. There you’ll find a file named “SDK Setup.exe.” Start that file. The following window should appear.

 

Don’t feel bad in downloading every single thing. Annoying? Not really, my friend. I only really want to program for Android 2.1 and 2.01, so those are the only API packages I bothered to get. Either way, you can get whatever you want. The Android SDK Manager will install it for you in a minute. Until it does the job, go grab a snack.

Step 6: Setup you Android Virtual Device

Now you’ve finished all the painful downloads. So now it’s time to setup your Android Virtual Device (AVD). Virtual Device is device that will be available on the screen of your PC or Mac and will test your Android Apps. In Android SDK Manager, click on “virtual devices>New” and put the specifications you want. In the screenshot below, you can see the options I wanted (closely related to Motorola Droid).

Now click Create AVD button. After creating, select your AVD from the list and click Start button to test your AVD. After a painful start-up wait, you should see something like this:

Now close it for going back to work.

Step 7: Re-Configure Eclipse

Remember that Android SDK that we configured in Step 5. We haven’t used it till now. So now it’s time to tell Eclipse for using Android SDK. For performing this task, open Eclipse and navigate to Window>Preferences (on Mac, Eclipse>Preferences) and select the Android tab. As shown in the screenshot below, browse to the destination of your Android SDK and hit “Apply”. Press OK to save your settings.

Step 8: Create a New Project

Now come the coding time! Navigate to ‘File>New>Other…>Android>Android Project‘, and input a project name, as well as some other details. If you want, then you can copy from the screenshot given below.

Hit Finish to create the project.

Step 9: Input your Code

In the tree on the left, navigate to “src” folder and expand everything. Go to the file with the name of your Activity. Mine was “Hello World”. And double click it to see the content. Right now, there are only black color of the contents in your code. To make things work, you need to add the text that is in bold red.

//==========Start Code============

package com.android.helloandroid;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       TextView tv = new TextView(this);        tv.setText("Hello, Android");        setContentView(tv);
   }
}

//==========End Code============

 

I really love to explain things in details. But if I go in full details, then this guide will become too lengthy. This guide is written to get your feet off the ground. I know that some/most of these things may be confusing for you, but that’s the way how things are wired.

Step 10: Run Your App

Now click on the little “Play” button. After clicking, a pop-up will ask you to how to run the application. Reply it, “Android Application”. It will prompt you to save changes, hit ”Yes”.

Now there’s yet another painful waiting time. Your device will boot up, Android Logo, program freeze up. It’s all about patience and efficiency. I’ll recommend you to leave it open for the duration of your programming sprees. Otherwise, open it after completing the code and go, get a cup of coffee.

After everything is done, your Android App should upload and start automatically. It means that right after you unlock the device, you should be greeted with your first Android App.

That’s it! Congrats, now you’ve created your first Android App. Things may seem you a little bit confusing, but if you want to be an Android dev, and you stick in these things, then surely one day these things will seem you pretty easy. And in my opinion, developing and programming both require time, patience and efforts.

Have you ever written any other Android App? Do you wanna be an Android Dev? Let the world know your words in the Disqus thread below and keep visiting Gadget Media for more interesting News, How-To Guides and other stuff.