| Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 1 | page.title=Samples |
| 2 | |
| 3 | @jd:body |
| 4 | |
| 5 | <p>To help you understand some fundamental Android APIs and coding practices, a variety of sample |
| Scott Main | 53b0fda | 2012-08-06 12:50:48 -0700 | [diff] [blame] | 6 | code is available from the Android SDK Manager. Each version of the Android platform available |
| 7 | from the SDK Manager offers its own set of sample apps.</p> |
| Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 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 |
| 14 | directory.</li> |
| 15 | <li>On Mac or Linux, open a terminal to the {@code tools/} directory in the |
| 16 | Android 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 | |
| Scott Main | 53b0fda | 2012-08-06 12:50:48 -0700 | [diff] [blame] | 22 | <p>When the download is complete, you can find the source code for all samples at this location:</p> |
| Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 23 | |
| 24 | <p style="margin-left:2em"> |
| Scott Main | 53b0fda | 2012-08-06 12:50:48 -0700 | [diff] [blame] | 25 | <code><sdk>/samples/android-<version>/</code> |
| Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 26 | </p> |
| 27 | |
| Scott Main | 53b0fda | 2012-08-06 12:50:48 -0700 | [diff] [blame] | 28 | <p>The {@code <version>} number corresponds to the platform's |
| 29 | <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level</a>.</p> |
| 30 | |
| Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 31 | <p>You can easily create new Android projects with the downloaded samples, modify them |
| Scott Main | 53b0fda | 2012-08-06 12:50:48 -0700 | [diff] [blame] | 32 | if you'd like, and then run them on an emulator or device.</p> |