Getting Started with Android
Posted by David Chandler on February 7, 2012
I’ve recently joined the Android Developer Relations team at Google and am thus renaming this blog David Chandler’s Journal of Java Web and Mobile Development. Some of my favorite Google platforms are intersecting in new ways all the time (witness today’s announcement of Chrome Beta for Android ICS). Having done Web development for 18 years, I now turn my attention to mobile development, where I’m cautiously hopeful that HTML5 will make it easier in the long run to build cross-platform mobile apps.
As I started to ramp up on Android, my first thought was, “Why on earth did I ever wait so long to try this?” There’s something magical about connecting the USB cable to my phone and seeing my own work appear there. Perhaps it’s because I was an iPhone user for a few years and felt out of touch with my phone as a Java developer. At any rate, in no particular order, here are a few notes that I hope will be helpful to Android newbies like myself. If you’re an experienced Android developer, it will no doubt take me a while to catch up with you. Please feel free to post your favorite tips and tricks in the comments as we go along.
Getting Started with Android
To get started, I installed the Android Developer Tools plugin for Eclipse and started working through the tutorials on the Android Developer site. At first, I was trying too hard. To get started, you really don’t need to worry about adb or running “android” from the command line, as you can launch the AVD manager and SDK manager right from Eclipse. The tutorials are written to run apps using the emulator, but it’s easy and faster to use your actual phone:
- On your phone under Settings | Applications or Settings | Security, allow “Unknown sources.”
- On your phone under Settings | Development, enable “USB debugging.” It’s also useful to enable “Stay awake” so you don’t have to unlock the screen frequently.
- Plug in your phone via USB cable and choose the “Mount as disk drive” option if prompted. You should now see it listed when you run “adb devices”.
- In Eclipse, click Debug as | Android Application. You will be prompted to choose a device (which should show up automatically) or launch an emulator. Edit the launch configuration for each project to change the default action.
Creating visual appeal
Capturing screen shots
When you upload your app in the Android Market, you’ll need two screen shots of your app. The ADT plugin for Eclipse has a tool that makes this easy. Open the DDMS perspective and click the camera tool to snapshot a running emulator or connected device.
There’s also a third-party utility to project your phone’s screen onto your display. This is really useful when giving Android talks for your local JUG or GTUG.
Packaging your app
Publishing to the Android Market
Introducing Fibonacci Series for Android
For my first app, I took a shallow dip into my creativity pool and came up with a Fibonacci Series calculator. There are several Fibonacci apps (mostly involving stock trading) already, but I just needed a simple calculator for when I’m on a dinner date with friends and suddenly can’t remember one of the five-digit Fibonacci numbers, for example. Regular readers of this blog will recognize the related sunflower illustration thrown in for good measure. The app gave me a good opportunity to use simple TextViews, a custom view for the Canvas on which to draw the sunflower, and practice handling orientation changes (go ahead, turn it sideways and see what happens). Oh, and I incorporated a tabbed interface and the menu button also. There are lots of tutorials on these topics online already, so I think for now I’ll just point you to the source code.
As a newcomer from GWT, I found the concept of an Activity very familiar (GWT’s Activities and Places are deliberately modelled after the Android). I ran across only a few gotchas. One that I remember is that overriding onConfigurationChanged() in your Activity does not guarantee you will get notified of all orientation changes because it doesn’t get called if another app is in the foreground when the orientation changes. But no matter, you can check every time in the Activity’s onCreate() method. It also took me longer than it should have to figure out how to hook into the phone’s menu button (just override onCreateOptionsMenu()). The tutorials on the Android Developer site as well as the new Android Training section under Resources cover most of the beginner topics quite well.
For new developers, the single most useful page on the site is this one: Common Tasks.
And don’t forget the android tag on Stack Overflow, which Google officially supports.
Once again, here’s the source.
Enjoy!


Roland Schweitzer said
Hi David,
Welcome to Android. I’m sure you’ll be passing me up soon enough, but one thing I suggest is that you might not want to automatically do step 3 of “Mount as disk drive” because then your SDCARD becomes a device mounted on the attached computer and is no longer visible to your apps. If you’re developing media applications, writing temporary files to the SDCARD and whatnot you won’t be able to see it from your app while it’s mounted.
Roland
David Chandler said
Thanks, Roland! With Gingerbread, I was under the impression that I needed to mount as disk drive for USB debugging to work, but I never tried otherwise, just assumed that “Charge only” and the other options wouldn’t work. With ICS and Mac, mounting as a drive has been replaced by MTP, so access to the SD card is no longer a concern there.
deepakjacob said
Looks like GWT’s fate is sealed !. Please prove me wrong !
Nick said
You’ve probably already seen this http://blog.oio.de/2011/12/08/future-of-gwt-and-gwt-2-5/
GWT doesn’t seem to be dead, but it still leaves the question of what happened to the GWT team? Why are some leaving…
David Chandler said
HI Nick, AFAIK GWT 2.5 is still in the works. Ray Cromwell is (much) closer to it than I am. As far as folks leaving the GWT team, some were pulled into Dart for their compiler experience, some are working on cool new stuff, and the few external departures had been at Google a long time and went to startups. It’s hard to resist the call of the Cool New Thing (says the Android newcomer to himself).