How to Use the Recipes in This Book

In general, the code recipes in this cookbook are self-contained and include all the information necessary to run a working application on an Android device. As discussed in detail in Chapter 2,"Application Basics:Activities and Intents," there are multiple usergenerated files needed to get an application working.When even one is omitted from an example, its absence impedes those unfamiliar with the Android setup. Therefore, every recipe contains the necessary files to get code working. Each file is shown as a code listing with the full filename as the title. This helps to convey where the file lives in an Android project.

At the same time, when too many files are shown, it clouds functionality. Therefore, two coding styles are slightly different than would be expected in a normal application:

■ The code has limited comments.The text explains the functionality clearer than inline comments could, and bolded code shows the main lines needed to get the particular technique working. In practice, actual code should have more comments than presented in the recipes.

■ Strings are explicit and do not point to a global resource.The method of using a global resource for strings is encouraged and discussed in detail in Chapter 4,"User Interface Layout," with multiple examples. In this book, however, when only a few strings are needed for a recipe, the strings are made explicit rather than including a whole additional file just to define them.

People just starting with Android are served well to use Eclipse for the development environment with the Android plugin. As discussed more in Chapter 2, this ensures proper Android project setup and context, and Eclipse even adds a placeholder icon figure. It also helps with more advanced tasks, such as signing an application for distribution.

The emulator provided with the Android Software Development Kit (SDK) is useful, but nothing beats seeing the application run on a true Android device. It leads to faster development and more realistic testing. All code examples in this book have been tested on an actual device running Android 2.1, and as needed,Android 1.5 or Android 2.2. Some functionality (for example, Bluetooth pairing or sensor changes) is difficult and opaque when using the emulator. Therefore, it is recommended that initial testing be done with an action Android device.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment