• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1guide=true
2page.title=Sample Code
3@jd:body
4
5
6<p>Sometimes, the best way to learn how things are done is to look at some code.
7Here, you can browse the source of some sample Android applications that are included
8in the Android SDK.</p>
9
10<p>Each version of the Android platform available for the SDK includes a full set of sample
11applications (which may vary between different versions of the platform).
12You can find the samples in your SDK at:</p>
13
14<p style="margin-left:2em">
15<code><em>&lt;sdk&gt;</em>/platforms/android-<em>&lt;version&gt;</em>/samples/</code>
16</p>
17
18<p>You can easily create new Android projects with these samples, modify them
19if you'd like, then run them on an emulator or device. For example, to create
20a project for the API Demos app from Eclipse,
21start a new Android Project, select "Create project from existing source", then select
22{@code ApiDemos} in the {@code samples/} directory. To create the API Demos project
23using the {@code android} tool, execute:</p>
24<pre>
25android update project -s -n API Demos -t <em>&lt;target_ID></em> -p <em>&lt;path-to-platform></em>/samples/ApiDemos/
26</pre>
27
28<p>The pages below provide an overview of each sample application (available with most
29platforms) and allow you to view the source files in your browser. </p>
30
31<dl>
32
33 <dt><a href="ApiDemos/index.html">API Demos</a></dt>
34  <dd>A variety of small applications that demonstrate an extensive collection of
35  framework topics.</dd>
36
37 <dt><a href="Home/index.html">Home</a></dt>
38  <dd>An application for saving notes. Similar (but not identical) to the
39    <a href="{@docRoot}guide/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
40
41 <dt><a href="JetBoy/index.html">JetBoy</a></dt>
42  <dd>JetBoy is a game that demonstrates the SONiVOX JET interactive music technology,
43  with {@link android.media.JetPlayer}.</dd>
44
45 <dt><a href="LunarLander/index.html">Lunar Lander</a></dt>
46  <dd>A classic Lunar Lander game.</dd>
47
48 <dt><a href="NotePad/index.html">Note Pad</a></dt>
49  <dd>An application for saving notes. Similar (but not identical) to the
50    <a href="{@docRoot}guide/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
51
52 <dt><a href="SearchableDictionary/index.html">Searchable Dictionary</a></dt>
53  <dd>A sample application that demonstrates Android's search framework,
54  including how to provide search suggestions for Quick Search Box.</dd>
55
56 <dt><a href="Snake/index.html">Snake</a></dt>
57  <dd>An implementation of the classic game "Snake."</dd>
58
59 <dt><a href="SoftKeyboard/index.html">Soft Keyboard</a></dt>
60  <dd>An example of writing an input method for a software keyboard.</dd>
61
62</dl>
63
64
65<div class="special">
66<p>For more sample applications, check out
67<a href="http://code.google.com/p/apps-for-android/">apps-for-android</a>, a
68collection of open source applications that demonstrate various Android APIs.
69</p>
70</div>
71
72
73