O'Reilly logo

Android Application Development by G. Blake Meike, Zigurd Mednieks, John Lombardo, Rick Rogers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. The ApiDemos Application

The ApiDemos application comes with the Android SDK, and can be found in the samples/ApiDemos subdirectory. It’s a treasure trove of code that shows an application developer how to use a lot of the Android API. Unfortunately, it’s left up to the student to figure out how it works. That’s where this chapter comes in. Here, we’ll show you the ropes of the ApiDemos application, and how to find the code that implements a feature that you see. Once you get the hang of it, it’s a very useful place to find out how to use Android.

For the remainder of this chapter, we’ll make a couple of assumptions when talking about files and directories:

  • Non-Java source files and subdirectories can be found in the samples/ApiDemos subdirectory of the directory where you install the Android SDK.

  • Java files are in the src/com/example/android/apis directory under the samples/ApiDemos directory.

Application Setup in the Manifest File

Like every other Android application, the best place to get a sense of how the application is strung together is the application’s AndroidManifest.xml file. Let’s take a look at part of the AndroidManifest.xml file for ApiDemos, near the beginning of the file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"1
    package="com.example.android.apis">

    <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required