
Ask HN: Jumping into Android Development - wallflower
I like taking a jump in the deep end approach.<p>I'm a Java developer turned iPhone developer.<p>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?<p>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.<p>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.
======
heliodorj
I'm not a fan of learning from technical books, but that's just my style. I
like figuring out exactly what I need to do and Googling it one piece at a
time, side-by-side with having the docs as reference.

You could start by reading the dev guide from the top:
[http://developer.android.com/guide/basics/what-is-
android.ht...](http://developer.android.com/guide/basics/what-is-
android.html).

You should read the Activity lifecycle some ten times at least:
[http://developer.android.com/reference/android/app/Activity....](http://developer.android.com/reference/android/app/Activity.html).
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...](http://developer.android.com/guide/topics/intents/intents-
filters.html).

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...](http://developer.android.com/resources/dashboard/platform-
versions.html).

Designing the interface layout is pretty painless. The framework is well
thought out.

~~~
wallflower
Thank you for the tips on intents. I second you on the books as I like to
exercise my Google foo; I don't read those books I buy - most are pure
reference. I think I've gotten the books simply to feel like I'm becoming X
(in the geek friends over, coffee table sense). And there are times where
bringing the book(s) to a park sans computer makes me realize the concepts
better. I didn't realize the G1 was so slow! But if it works on the G1, then
I'm golden.

Going to use my dead tree allotment and _print out_ the Activity and Intents
reference documents you highlighted. Thank you.

------
dpcan
Stackoverflow with the [android] tag is going to be your biggest resource for
q & a in my opinion. Googling for Android dev stuff is a pain as you get a lot
of strange and barely useful Google groups threads and clones.

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.

~~~
wallflower
I know I can possibly use Titanium to cross-develop to multiple platforms
simultaneously but I like to think if you can develop iPhone and Android apps
for a client that are near functionally equivalent - you have a stronger base
when dealing with large and/or quasi-governmental agencies that have
accessibility rules. Of course, mobile formatted websites are always going to
work for the widest spectrum.

------
theBobMcCormick
If you're already a java developer, you should probably be able to jump in
just from the official docs: <http://developer.android.com/guide/index.html>

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.

~~~
wallflower
> It would be nice if there was a good visual layout tool available... but oh
> well.

Titanium doesn't have a visual designer but I wonder what would happen
overnight if Google bought Appcelerator.

------
ableal
This may help:
[http://www.tbray.org/ongoing/When/201x/2010/04/25/LifeSaver-...](http://www.tbray.org/ongoing/When/201x/2010/04/25/LifeSaver-
Lessons)

------
acj
_What books do you recommend?_

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...](http://stackoverflow.com/questions/371538/any-good-orm-tools-for-
android-development)

 _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).

~~~
wallflower
Thanks, have scaled back the time estimate. Goal is yo just start getting
hands dirty and dirtier.

------
bigsassy
You may want to check out this free online seminar:

<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.

------
zackola
Highly recommended. [http://www.amazon.com/Professional-Android-Application-
Devel...](http://www.amazon.com/Professional-Android-Application-Development-
Programmer/dp/0470565527)

~~~
jedc
Reto (the author) is a wicked smart developer who is now on the Developer
Relations team at Google. While I haven't read/used it myself (not a
Java/Android programmer) I can speak to excellence of the author.

------
briancooley
I really like the books by Mark Murphy at commonsware.com. I have submitted
some errata to Mark, and I think I have a spare coupon code you could use for
a 6 month subscription if you want to take a look. My email is in my profile.
Mark also does a one hour Office Hours session about twice a week, and that's
been helpful.

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)

~~~
wallflower
Android 1.6 seems like a good LCD target and 2.2 seems like the new hotness.

> 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.

~~~
briancooley
My comment about Hibernate was wrong. A while back, I saw a thread on
StackOverflow about ORM's on Android that linked to another thread about
Hibernate. I just went back and looked and the linked comment was suggesting
"lightweight alternatives to Hibernate."

Threads in question: [http://stackoverflow.com/questions/371538/any-good-orm-
tools...](http://stackoverflow.com/questions/371538/any-good-orm-tools-for-
android-development) [http://stackoverflow.com/questions/296587/light-weight-
alter...](http://stackoverflow.com/questions/296587/light-weight-alternative-
to-hibernate)

~~~
wallflower
Thanks for the correction. sqlite seems to be ok, marshalling and
unmarshalling into Java.

------
gte910h
Three weeks is pitifully small when coming online with android. The tools are
much much less good than iPhone.

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.

~~~
wallflower
I'm revising my estimates based on the feedback you and others here have
provided, and I'm still going to dive in.

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.

~~~
gte910h
As far as the data goes, I believe you'll be able to get something going
relatively easily that is a good enough replacement.

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.

------
tim_church
You might be interested in this free 6-week course on Android development from
O'Reilly starting next week - <http://creativelive.com/courses/android2/>

I saw this on HN about a month ago. I'm enrolled so I hope it is worthwhile.

------
phernandez
I can second the commonsware books mentioned previously. They are very helpful
because you can download the source and run the apps to see how they work.
Also check out the AppDemos that come with the sdk for examples.

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.

~~~
wallflower
> Especially useful to see how they put their layouts together.

Thanks. I love examples because you can see the craftmanship.

------
mitchellhislop
As a developer who is taking on Android as his first mobile target, I have
found that joining mailing lists for apps that are being group-developed helps
a ton. Gina T (from lifehacker/smarterware) is starting a new app for her
todo.txt idea that is totally OSS, so you can follow along, fork it and get
into the code yourself, or use the community to find people to ask questions
to.

------
Jun8
_Unlocking Android_ from Manning is excellent. Once you gain more knowledge
you cam move on to _Pro Android 2_ from APress.

~~~
jraines
Does the former assume you will be using Eclipse?

~~~
Jun8
UA shows you how to work with the Eclipse tools but overall it's fairly
general, no reliance on Eclipse.

------
shareme
GNUStep was working on a free coredata implementation

