Laman

Just show me the code

OK, you've downloaded the SDK and are now ready to build the next killer app for mobile (and maybe win some $$$ in the process ;)



Activities? Intents? SimpleCursorAdapter? Huh? Hmm...how do I proceed?



Well, that depends on your style. Some will want to carefully go through all the documentation top-to-bottom, while others may prefer to just dive right into code.



Either path will eventually lead to the sample applications provided in the SDK — these samples will be invaluable in your quest for Android mastery. The samples include:




API Demos

A 'kitchen sink' application that covers the most useful aspects and components of the Android APIs. You'll see different implementations of Activities, Services, Notifications, Layouts, as well as methods for working with graphics and text. This application provides a good source of templates for your projects as well as a reference to 'How do I do this?'-type questions.


Lunar Lander

A game which demonstrates how to load and draw graphics, animation techniques, taking user input, saving state when the user pauses the game, and more. Coding shouldn't be this fun!


Note Pad

You'll learn how to use Intents to open a new screen, access a local database, and more. This sample is a good introduction to application flow and life cycle management, which are vital in developing more complex applications.



Source code and resources for these applications are available in the SDK (samples/) as well as online: http://code.google.com/android/samples/



Here are some suggestions on what to do next:




  • Read through each application's manifest file (AndroidManifest.xml) to learn about the typical structures in an Android application.

  • Modify the code to familiarize yourself with the building and testing process.

  • Use a particular code snippet as either a base template or to get some needed functionality for your own project (why reinvent the wheel?)



Put these sample applications through their paces; and if you get stuck, please post your questions to the Android Developers Discussion Group.