• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Samples
2page.tags="example","code"
3@jd:body
4
5<p>To help you understand some fundamental Android APIs and coding practices, a variety of sample
6code is available from the Android SDK Manager. Each version of the Android platform available
7from the SDK Manager offers its own set of sample apps.</p>
8
9<p>To download the samples:</p>
10<ol>
11  <li>Launch the Android SDK Manager.
12    <ul>
13      <li>On Windows, double-click the SDK Manager.exe file at the root of the Android SDK
14directory.</li>
15      <li>On Mac or Linux, open a terminal to the {@code tools/} directory in the
16Android SDK, then execute {@code android sdk}.</ul>
17  </li>
18  <li>Expand the list of packages for the latest Android platform.</li>
19  <li>Select and download <em>Samples for SDK</em>.</li>
20</ol>
21
22<p>When the download is complete, you can find the source code for all samples at this location:</p>
23
24<p style="margin-left:2em">
25<code>&lt;sdk&gt;/samples/android-&lt;version>/</code>
26</p>
27
28<p>The {@code &lt;version>} number corresponds to the platform's
29  <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level</a>.</p>
30
31<p>You can easily create new Android projects with the downloaded samples, modify them
32if you'd like, and then run them on an emulator or device.</p>