Ok so it did not really take 10 seconds. I had been developing iPhone apps for a while; but an urgent need had arisen for someone to do an Android project and they asked if I would be willing to do it. Well, I like learning new things so I jumped in. For anyone else in this position I would like to share a few tips so the idea does not seem so intimidating.
XCode to Eclipse
The first thing that you need to do is install Eclipse and the Android SDK. I found the instructions on this page to be superb. Following those steps to the letter got my development environment up and running within an hour.
Now that Eclipse was running I was staring at it looking for what to do next. There are a lot of internet tutorials and books on how to get started. Personally, I like books, so I snagged a copy of “Android Wireless Application Development” by Lauren Darcey and Shane Conder. The title of the book is misleading since it actually covers most major aspects of Android development. I found the book’s style to be inviting and the book’s information invaluable and I had a “Hello World” project running in the Android Virtual Device emulator within another hour. Which brings me to another point.
The Android Virtual Device emulator is the “equivalent” of the iPhone Simulator. However, the Android emulator is, in a word, $#!&. It takes minutes (yes I said minutes) for the emulator to start and more minutes to load your project’s debug runs. I would suggest looking for a cheap Android phone somewhere (I used eBay) as quickly as you can. The load time for a project debug run on a real phone is a fraction of the time using the emulator.
Objective-C to Java
The book got me going quickly but I had to start working on my project which was converting an iPhone app to Android. There is not a lot of code in an iPhone app that can be reused simply because Android apps are written in Java. As I started to pick up more of the Java language, I realized that there are a lot of things in Objective-C that have analogous constructs in Java. These are not necessarily 1 for 1 translations but it helped give me some structure for the new project.
UIViewController -> Activities
UIView -> View
NSMutableArray -> ArrayList
NSMutableDictionary -> HashMap
Delegates -> Listener
UITableView -> ListView and Adapters
Believe it or not, understanding the Activity, View, ArrayList, HashMap, Listener, ListView, and Adapter classes will take you a long way in converting any iPhone app to an Android app.
One Response
Good article, thanks for publishing.