Samples

To help you understand some fundamental Android APIs and coding practices, a variety of sample code is available from the Android SDK Manager.

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 samples sources at this location:

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

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.