68 points · by wallflower · 16y ago · 27 comments
I'm a Java developer turned iPhone developer.
What books do you recommend? When I first started iPhone development, I bought hundreds of dollars of books and it helped tremendously to have different teachers on paper. What are the best-of-class Android apps (in terms of user experience) that you like? What are your favorite apps? What is the best part about working with Android?
I'd like to port a fairly complicated iPhone application to Android. Since I want to support the widest range of Android devices, I'm targeting the G1 as the lowest common denominator. The existing iPhone application heavily relies on CoreData, and I feel that is the biggest hurdle. Are there are any CoreData like persistence frameworks? I, admit too, that I am scared of the "unholy mixture of XML and GridBagLayout" that is required to build UIs in Android - but that is a secondary concern.
Is three weeks, give or take a few days, too aggressive a deadline for doing a port from iPhone to Android? I will compromise where needed.
You could start by reading the dev guide from the top: http://developer.android.com/guide/basics/what-is-android.ht....
You should read the Activity lifecycle some ten times at least: http://developer.android.com/reference/android/app/Activity..... To avoid countless headaches at the beginning, clamp your app to only portrait or only landscape mode if it makes sense.
Also read over the Intents doc a number of times as they are another crucial part of the system: http://developer.android.com/guide/topics/intents/intents-fi....
The Android SDK contains various samples that will get your going quickly.
Having a G1 to test with is a good idea. They are painfully slow, so if you get the G1 right, everybody else will be happy. Quick stat: devices by platform: http://developer.android.com/resources/dashboard/platform-ve....
Designing the interface layout is pretty painless. The framework is well thought out.
Going to use my dead tree allotment and print out the Activity and Intents reference documents you highlighted. Thank you.
As for books, I bought a beginners book to get started, but you're probably beyond that if you have Java experience.
The Google examples and dev starter page are enough to get rolling actually.
Also, regarding targeting devices; in your manifest, you can set a lowest possible SDK and a target SDK and compile against 1.6, and then allow for the device to do the density control and you can almost target all the devices in one APK. You just have to make sure not to use any code that doesn't work in the 1.5/1.6 versions of Android - but if you're in eclipse, it will help out a little with this. My games are getting downloaded by 1.5 users and Droid 2.x users.
I think the thing you'll hate the most right out of the gate is the 24-hour return policy in the Android market - especially since you're coming from iPhone.
People can buy your app, but you don't know if it's a sale for 24 hours when it finally closes. In that limbo time, they get to use it for free and just by uninstalling they get their money back - or rather - their transaction never happens. It's great for the end user, but hard to cope with as a developer who thinks they have sales, but overnight they just go away every now and then. I've had up to 25% cancellation rates on bad days.
Whatever you are creating, I hope it has repeat value, I think that's one of the only ways to get around the cancellation problem.
Follow along with the tutorials, then download some of the sample apps to work with. I've also found that downloading the source code to the Android project itself is pretty worthwhile. You can look at the source to almost all of the apps included in a default installation (dialer, camera, music, browser, etc.)
Last I checked, most of the books are being outdated pretty fast. Don't even bother with any book that doesn't cover 2.0 at least, 2.1 preferably.
For most apps, covering the broad range of devices isn't very difficult. The emulator that comes with the SDK will let you emulate different display resolutions. You can also run any version of the Android OS on the emulator to test your app under different OS versions.
The "unholy mixture of XML and GridBagLayout" is actually pretty easy if you've ever worked with an HTML CSS grid framework like Blueprint, 360Grid, or YUI grid. At least, it's made pretty good sense to me so far. It would be nice if there was a good visual layout tool available... but oh well.
I'm not aware of a CoreData like high level persistence framework. App data storage is usually done with the built in SQlite libraries. I believe you're on your own so far in building higher level abstractions on top of that.
Titanium doesn't have a visual designer but I wonder what would happen overnight if Google bought Appcelerator.
I've depended entirely on the web for learning Android development, but I've heard good things about the Android books from http://commonsware.com/. He has some helpful (free) tutorials available as well.
What is the best part about working with Android?
For me: flexibility and transparency. I like to get my hands dirty and gain a deeper understanding of the system, and it's quite helpful having (1) access to the source code for almost the entire system and (2) root access on the device. Those things likely won't matter when you're writing your first Android app, but it will matter when you're doing something uncommon or complex.
Are there are any CoreData like persistence frameworks?
I haven't needed any for my own apps, but the framework has integrated data storage engines. I imagine that someone has built a CoreData-like layer that uses them. This link might be helpful: http://stackoverflow.com/questions/371538/any-good-orm-tools...
Is three weeks, give or take a few days, too aggressive a deadline for doing a port from iPhone to Android?
Can you give us any more details? Your time commitment will vary significantly depending on the complexity of the app. If it's a 3D game, then three weeks might not cut it. If it's a reasonably straight-forward app that doesn't have a ton of features, then three weeks will be ample time given your prior experience.
A few other thoughts: don't be afraid of Android UI building. It isn't as scary as it sounds. heliodorj's comments about reading the Activity/Intent/Multitasking documentation are spot on -- making sure that you grok those concepts will save you time and frustration. Be sure to test on a real phone, preferably one that isn't super speedy so that you don't frustrate users with older hardware (e.g., the G1, aka HTC Dream).
http://creativelive.com/courses/android2/
Here's the description:
Course: Developing Android Apps - A Twitter Client Instructor: Tony Hillerson Length: 6 Weeks
You can never have too many Twitter clients. In this programming course, Tony walks you through setting up sign ins, creating a public timeline, making sure your app is responsive and giving it style to stand out from the flock. Finally, for those times when 140 characters isn't enough, we'll extend our Twitter client to also post photos to the popular Twitpic image service.
As for ORM, I have been using SQLiteOpenHelper and SQLiteDatabase directly, but I had heard that you can use Hibernate (edit: don't think this is true). Also, there is one that recently released but is not free (I have not tried it and have no affiliation): https://www.activeandroid.com/
As for platform target, I would just go with Android 1.6 unless you need something specific from the more recent releases. That covered most of the market in January, and there have been a ton of 2.0 and higher phones sold since then.
I'm far from an expert, but I'd be glad to chat with you if you run into any questions. (I'm working in the other direction, trying to learn some iPhone OS)
> I'm far from an expert
Don't discount yourself. I honestly don't like the expert title, as I feel its misapplied in most instances. Feel free to post an Ask HN on Android to iPhone and I'll do a braindump (still trying to preserve my semi-anonymity but may drop it just to collaborate with the HN community)
I had no idea you could use Hibernate on a frigging phone. That scares the hell out of me - as in it opens the door for crazy thoughts like will mobile environments become so powerful you use real Java stuff like Spring.
Threads in question: http://stackoverflow.com/questions/371538/any-good-orm-tools... http://stackoverflow.com/questions/296587/light-weight-alter...
You're not really programming java per se, as a java like language missing half the API's you're used to. If you PM me a link to the iPhone app, I'll tell you my guess at a timeframe.
Secondly, the G1 (which runs 1.6) is not the lowest common denominator at the time. While it does have some of the wimpiest specs, other phones, such as the Moto Cliq, are still stuck on 1.5.
Additionally, I suggest you check out http://commonsware.com/Android/ which had a nice section on scripting on the phone, which was invaluable for testing out UI design alternatives.
Not seeing your iPhone app, I honestly suggest telling them "This could take between 2 and 10 weeks, and will likely take more like 5 or 6".
While you're probably keen on eclipse, also check out how to develop without it, so you can use the debugger without eclipse getting in the way. It is a tad bit unreliable at times.
The app is a fairly typical CoreData-based tab bar app that makes heavy use of Google Maps (MKMapView) and UITableView. There is some custom UI in it but it's not that critical to the overall app.
To minimize risk in my approach, I'll address learning how Android's UI architecture works by just trying to create an app and tie screens together. And have a parallel lower-priority going on how to get some semblance of ORM (reading , not updating data) on the G1.
If you can ditch the custom UI for the app, that will help, as again, that's much harder in the Android world than the iPhone world to start with.
If all else fails, for a V1 (if this is only readonly), you can always write a program to dump your database into a java class which "hardcodes" the data.
Remember, you can update to the store in seconds on android. No review process, takes only 20 minutes or so to sign up for the whole developer account.
Additionally, this Really got me when I started with it: You can't see the paid apps on the android store if you don't link your phone to a google account with a valid google checkout profile. I made a fake google account on the dev phone (which I wasn't sure I was keeping), and was confused as hell during the upload process because of this.
I saw this on HN about a month ago. I'm enrolled so I hope it is worthwhile.
The http://android.git.kernel.org/ site has the source for lots of the bundled apps too. Especially useful to see how they put their layouts together.
Thanks. I love examples because you can see the craftmanship.