to top

Samples

To help you understand some fundamental Android APIs and coding practices, a variety of sample code is available from the Android SDK Manager. Each version of the Android platform available from the SDK Manager offers its own set of sample apps.

To download the samples:

  1. Launch the Android SDK Manager.
    • On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
    • On Mac or Linux, open a terminal to the tools/ directory in the Android SDK, then execute android sdk.
  2. Expand the list of packages for the latest Android platform.
  3. Select and download Samples for SDK.

When the download is complete, you can find the source code for all samples at this location:

<sdk>/samples/android-<version>/

The <version> number corresponds to the platform's API level.

You can easily create new Android projects with the downloaded samples, modify them if you'd like, and then run them on an emulator or device.