13 January 2010

Developing Android apps -> get familiar with ApiDemos

... just another beginner tip I thought Id'e put out there in case it saves anyone some time.

When starting off with Android development, you'll immediately start wondering how basic stuff is done and you'll need example code. Like how to get a menu in your app, how to launch new Activities and how to get data into your Spinner (aka drop down)

My second best tip for this is to get ApiDemos into your workspace.

You'll find it here:android-sdk/platforms/android-2.0/samples/ApiDemos
(replace the SDK version for what you're using obviously)

File -> New -> Other -> Android Project.
Select "Create project from existing sample"

Fire it up in your emulator and start clicking about. The app is brilliantly organized and you'll find everything pretty quickly after spending a few minutes toying with it. I got quite few ideas and gotchas just by clicking around looking.

The only downside with ApiDemo that it has complex reflection-like bootstrap, which makes it a bit hard to see how they actually start activities. So sometimes it's hard to find the source by tracking it. I ignored the bootup and took up the habbit of just doing a source search based on guessing, or click through the namespaces - you'll figure it out as I did I'm sure.

The silly #1 tip you already know: Google it ffs ;)

Lastly I'll add that the Common Tasks -page on the android site is quite useful.

/Finn

No comments:

Post a Comment