Android Development 101 – A tutorial Series

Android is the prime OS for developing applications in today for many reasons. The main reasons being that it is Open Source and Intuitive. In addition it uses Java for development, which is quite an easy language to get used to and develop in. This being said, a lot of you have great ideas for Android applications or applications in general but don’t know where to start. This series will take you behind the scenes and introduce you to the software that will be your best friend while developing for android. On this journey we will start with a “Hello World” and move on from there to create a database driven application with a touch and scroll interface. The final result will look something like this:

Working with tools to develop Android applications will be your greatest asset as you will come to realize early on. All of the tools I use will be listed to make development speedy and efficient while still looking good along the way. At best you will need to acquire Eclipse, I recommend the Eclipse IDE for Java EE Developers version as it is amazing for other types of development as well. The next tools you will get are the Android SDK, which allows you to hook the SDK into eclipse to reference its API and design an efficient functioning program. After that, this part is optional, look into DroidDraw which is essentially a GUI for designing the interface side of things so that you don’t have to blindly hack your way through the Android SDK and Java jungle.

Eclipse is fairly straightforward to setup and start using the Android SDK, you just have to download a package to include the SDK to Eclipses referenced files. To do this we will go to Help and then to Install New Software. We want to click Add to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK. Check both boxes and proceed to the next screen. You should make sure Android DDMS and Android Development Tools are both listed before going on. Accept license agreements and click Finish. You will have to restart Eclipse but after that your hook in is ready to be setup.

Android SDK is fairly straight forward to download for any system but updating it and hooking it into Eclipse is the key. After downloading the zip file (I’m using Windows/Linux but Windows examples will be default), unzip it to your C Drive and label the folder it will enter AndroidSDK. After entering said folder double click on the setup icon which will take you to the screen that shows you all the updates available for download. Download the latest updates and proceed to the top option Virtual Devices where you will make your first emulator. NOTE: if an update list does not show you will have to set the setup client to use http instead of https. When creating the emulator the name doesn’t matter and all you really need to set is a version you want to develop on. We will pick Android 1.5 from the list because if you decide to market an application you can reach more people and for the API’s we will use we don’t need 2.1 or 2.2. After setting up your emulator you are ready to have the two meet for the first time.

Going into Eclipse you will click the Window button and navigate to the Preferences option and click it. Select the Android option on the left and there will appear in the right side of the window a blank screen with a browse button. Click the button and find your AndroidSDK directory in the C drive and select that folder. Clicking Apply will make the blank window you were looking at show many different versions of the Android SDK and if you are able to see it you are on the right track. Click OK and we are ready to start developing.

NOTES: DroidDraw will be spoken about in another post in this series and we will use it to make part of our interface and the other half we will code ourselves. For everyone else developing in Linux I have found an awesome post that will describe how to set up your environment for Ubuntu and can possibly be transitioned for Red Hat and the like. Anyone who is having trouble feel free to let me know the issues you are having and I will try my best to not leave you behind before the next post.

I saw that this morning perusing the interwebs and as of right now you have to sign up for the access to it. I would love to check it out and see what the perks and products I develop would look like in App Inventor but they haven’t let me in yet…

As of right now you can either code with an IDE or simply code in a text file that the SDK will generate and build using Android SDK’s built in commands. If you have access to this product let me know what you think as I am very intrigued by it already!

@Greg this is very informative, and @steaky thank you for the link. This is very interesting and I hope HAD can also look into this. A simple programming platform to control android and do stuff. cheers!

Android is the prime OS for developing applications in today for many reasons. The main reasons being that it is Open Source and Intuitive. In addition it uses Java, which is quite an easy language to get used to and develop in.

I count at least 4 false statements in here and I haven’t even gotten to the third sentence yet!

@David Rysdam than you dont know android or general programming to well
you blog backs up my statement

nothing in this article shows me (as an android developer) that anything in this entry is false and Mr.Jacobs is a valued android developer so i trust what he says when the most complicated thing on your blog is a flipflop

@David Rysdam
I can only find one thing wrong; Java. Who thought Java would be a good idea? They didn’t even include all of it. It now takes a page of code to work around the absence of some of the stream creating calls. It used to be like one line. So much butt-hurt…

“for developing applications in today for many reasons”
Well I see that mistake but I just read over it and didn’t really notice in the article.

I think the article sounds good. Not really a droid guy myself and I am more into the hardware but I think it’s a good article none the less. I bet that as the new writers get more experience in writing articles to this bunch, the articles will also improve still. The first hackaday articles weren’t brilliant lets be honest, they have got much better over time.

I would agree on the Java front. The code should be C or some other language but after using it for development for so long it grows on you… just have to do twice the programming in C++ or C# to make up for it :)

On a side note, Google was probably targeting the biggest language market share possible (since Google drives Java and Python dev in their products) to entice them to develop for Android to increase the number of apps in the Market (iPhone App Store catchup :( )

Google would. The only way to get real work done is to go low-level on the Droid. Do you know if it’s possible to port python to Droid? It would be interesting and might even quench the fires of the great Python-Java flamewar. We could call it the 2010 Python-Java Peace Treaty.

hmmm… so I’m a busy guy, wrapped up in my day job and haven’t done much investigation into Android, even though I own an Android phone.

My personal interests are in such things as ‘how the hell do I write an app that does something useful on my HTC Hero/android Phone?’, ‘I have eclipse installed and I’ve done HelloWorld, but how do I hook up my android phone to my hardware/robot project?’.

That would possibly be more focused for a hackaday article. If I wanted a how-to-create-an-android-app I’d have visited google. I visit HaD to go that extra step. maybe that is the lesson to learn here, HaD wants to grow, you can only grow by having constructive feedback and then act upon it.

So, think of the audience, think of what you’re posting and then think of how the audience will perceive what you post. If you try to teach them to code java, then meh…. if you try to teach them how to code their Android device to interact with an AVR / PIC / Arduino then we may have something interesting that adds value and keeps us coming back for more….

I had run into this article early on and quickly passed it by because I almost always have my computer on me to test or develop an app that comes to mind (tendencies of a nerd i guess :P). Looking at the script to turn the phone’s ringer on or off depending on its position now makes me think that HaD’s devout crowd could modify the script and possibly have it play an integral roll in any number of hack’s (one off the top of my head would be the shopping cart video posted today!) and is quite exciting

“To do this we will go to Help and then to Software Updates which will have a tab that says Available Software. We want to Add Site to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK”

Before Revision:
“To do this we will go to Help and then to Software Updates which will have a tab that says Available Software. We want to Add Site to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK”

After Revision:
To do this we will go to Help and then to Install New Software. We want to click Add to be able to look up just Google’s packages they want us to download. In the location field enter https://dl-ssl.google.com/android/eclipse and click OK.

Hey, just wanted to let you know that your Eclipse download link goes to version 3.6, and according to Google it seems that the ADT plugin has known issues with 3.6. I personally haven’t been able to get it working on 3.6—I install everything as specified but the Android option does not appear in the pref window.

Purchased a brand new Wildfire about a month ago as a business phone however am very dissatisfied , firstly i’d have about 900 contacts on my earlier XDA and was able to view by organisation or particular person, not so on Wildfire only by individual which is of no use particularly with no search possibility either. Android 2.2 is supposed to have search facility but not different view possibility launch date seems to vary every time . Battery fairly good approx 18 hrs medium usage. Bluetooth poor, paired with parrott automotive package okay for day or so however won’t connect even by unpairing and pairing new, identical drawback with bluetooth headset……..any ideas cannot find something on http://www.htcwildfireforum.com assist would be appreciated

When I installed the ADT Plugin and went into preferences, there was no sight of an Android tab on the left, I reinstalled it. Am I doing something wrong? I’m running Eclipse 3.5 with Eclipse IDE for Java Devs.

Thanks for posting these tutorials. I was able to get a simple app running in just a few minutes after grabbing the dev toolkit and emulator in my Eclipse install. No idea I could get started that quick. Looking forward to working through parts 2-5.

i was trying to set up the eclipse and SDK but it wont find any targets. i put all the software on a flash drive but the virtual device is on my hard drive. i put the location in the SDk location, it said tools could not be found so i set it as the location of the SDK file (which is on a flashdrive) but still no targets

I followed your eclipse link and installed it as recommended. As someone mentioned, the link is to Eclipse 3.6, which the Android developer site says will not allow the ADT plugin to be installed.

I didn’t realize this until later, and the funny thing is that when I installed Eclipse 3.6, the ADT plugin was already installed. The instructions you gave here went through with only one minor hitch. (I had to restart Eclipse to get it to reload the target list in the last step, but I had installed them after starting Eclipse.) All else looks fine.

So do I have to worry about using 3.6? I noticed other people had problems with it, and the Android site does have a rather firm warning. Having gone through this, though, I’d prefer to continue rather than start again with 3.5.

You wrote
“Eclipse 3.6, which the Android developer site says will not allow the ADT plugin to be installed”

The site does not say anything like this.

The Android Developer Site recommends to to stay on 3.5. because of “known issues”. This is really easy to find, exactly where you would expect it. You _can_ install the ADT into 3.6 but you _will_ get strange errors in eclipse if you actually develop in 3.6.

I struggled a bit starting with ADT and eclipse. It took a while and with these resources I finally got it working out for me.
Hady look at the preference window and put the correct location as below:
SDK location = C:\Android\android-sdk-windows