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:
- 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 executeandroid sdk
.
- Expand the list of packages for the latest Android platform.
- 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.