For those of you that would like to give Android a spin, it is freely available at this direct link.
This post assumes the reader knows how to create a new android project and is somewhat familiar with the uses of the files automatically created in your Android project. My personal development environment is Eclipse since it integrates everything nicely, though be warned, you will need a relatively powerful system to run the power hungry Eclipse. If you have slower systems, be sure to read the Android tutorials on installing the SDK.
If you are like me, your first impressions of the SDK was a bit of a surprise (as with any embedded platform as this). As someone that just came out of college in more traditional computer engineering/computer science field, we weren’t exposed to the industry standard methods of building GUIs.
Let me explain. In college, we are used to code like this:
However, to accomplish the same thing in Android, it’s a little less obvious. There are multiple ways of doing it. You can do it by putting the code into the XML, then acquiring the handle by the XML ID to change the label, or you can do something very similar to the produced swing code.
In this day and age, however, coding GUI elements by hand is tedious, and to make this future proof and as friendly a transition for college students like myself to get into this style of development, we will create this simple application using a GUI builder, then acquire those references for dynamic use in our application.
Let me start off by recommending an amazing application: DroidDraw. This tool is much better for designing the actual positioning and relationship between your GUI elements (assuming for now that we will only be using standard Android GUI elements). You simply draw your GUI, then click on “Generate code”.
Next, paste the code it provides into the main.xml file generated by android. Then, we write the following code in our main activity Java file.
I’m not quite sure why Android chose to introduce as it’s first prime example such a complicated tutorial, but hopefully this early look at the corollaries between the Android platform and much more familiar widget toolkits is a help. The final output is rather obvious, but I’ll post them anyway.
Anyway, that’s a little something to whet the appetite as I patiently wait for my G1 to arrive (see my previous post’s screenshot – the picture has not change… sigh).
Hope you enjoyed, and I invite you to discuss and point out any mistakes I’ve made in the comments section!