Saturday, June 01, 2013

Creating my first Android application

I have long been interested in programming, especially with the newer mobile platforms (android, IOS, etc..), but never had a need or much time to work with it. Well, this week I got my new Android phone, and I decided now would be a good time to try my hand.
I first began looking at AppInventor as it seemed like an easy entry point. The website includes several tutorials on how to build and test apps using the point and click interface. My only concern is that this tool looks too easy, and once I am done with the tutorials, I may be stuck starting over again. Therefore, for my first pass I will be skipping this tool. I may come back to it later, especially if it allows quick starting point that can later be carried on with other development tools.
As I looked online, I found several tutorials for using the Eclipse IDE and the Android tools to develop apps. As I looked further, it appears that this is the official method that Google encourages, and therefore is the method to learn. I looked through many of the tutorials and it looks like it will have everything I need.
I was just about to download Eclipse and dependencies tools, when I saw that Google recently came out with an early access release of Android Studio, the next version tool for creating Android apps. If this means I can learn the next tool now, then all the better.
First off, downloading everything:


Install the JDK and Android Studio. There is a known error on some systems where Android Studio wont detect the JDK properly. If this happens, follow the instructions on the download page to setup the JAVA_HOME system variable.
From here, I followed the instructions shown at http://lirent.net/2013/05/android-studio-tutorial-for-beginners/ and http://karanbalkar.com/2013/05/tutorial-25-helloworld-application-using-android-studio/ to create my first Hello World! project.

A few things I learned with this first project:

When you  want to test your app on a physical device, you have to download the Google USB drivers through the SDK Manager. Then, you have to go into Computer Management and manually import the drivers.
When browsing the content of the project, MyApplicationProject > My Application > src > main > res > layout > activity_main.xml controls the layout of the display. This can be edited with a GUI, or with the raw XML.
When browsing the content of the project, MyApplicationProject > My Application > src > main > res > values > strings.xml contains the strings used in your project (useful for multilingual apps).