73 lines
2.8 KiB
Plaintext
73 lines
2.8 KiB
Plaintext
|
guide=true
|
||
|
page.title=Sample Code
|
||
|
@jd:body
|
||
|
|
||
|
|
||
|
<p>Sometimes, the best way to learn how things are done is to look at some code.
|
||
|
Here, you can browse the source of some sample Android applications that are included
|
||
|
in the Android SDK.</p>
|
||
|
|
||
|
<p>Each version of the Android platform available for the SDK includes a full set of sample
|
||
|
applications (which may vary between different versions of the platform).
|
||
|
You can find the samples in your SDK at:</p>
|
||
|
|
||
|
<p style="margin-left:2em">
|
||
|
<code><em><sdk></em>/platforms/android-<em><version></em>/samples/</code>
|
||
|
</p>
|
||
|
|
||
|
<p>You can easily create new Android projects with these samples, modify them
|
||
|
if you'd like, then run them on an emulator or device. For example, to create
|
||
|
a project for the API Demos app from Eclipse,
|
||
|
start a new Android Project, select "Create project from existing source", then select
|
||
|
{@code ApiDemos} in the {@code samples/} directory. To create the API Demos project
|
||
|
using the {@code android} tool, execute:</p>
|
||
|
<pre>
|
||
|
android update project -s -n API Demos -t <em><target_ID></em> -p <em><path-to-platform></em>/samples/ApiDemos/
|
||
|
</pre>
|
||
|
|
||
|
<p>The pages below provide an overview of each sample application (available with most
|
||
|
platforms) and allow you to view the source files in your browser. </p>
|
||
|
|
||
|
<dl>
|
||
|
|
||
|
<dt><a href="ApiDemos/index.html">API Demos</a></dt>
|
||
|
<dd>A variety of small applications that demonstrate an extensive collection of
|
||
|
framework topics.</dd>
|
||
|
|
||
|
<dt><a href="Home/index.html">Home</a></dt>
|
||
|
<dd>An application for saving notes. Similar (but not identical) to the
|
||
|
<a href="{@docRoot}resources/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
|
||
|
|
||
|
<dt><a href="JetBoy/index.html">JetBoy</a></dt>
|
||
|
<dd>JetBoy is a game that demonstrates the SONiVOX JET interactive music technology,
|
||
|
with {@link android.media.JetPlayer}.</dd>
|
||
|
|
||
|
<dt><a href="LunarLander/index.html">Lunar Lander</a></dt>
|
||
|
<dd>A classic Lunar Lander game.</dd>
|
||
|
|
||
|
<dt><a href="NotePad/index.html">Note Pad</a></dt>
|
||
|
<dd>An application for saving notes. Similar (but not identical) to the
|
||
|
<a href="{@docRoot}resources/tutorials/notepad/index.html">Notepad tutorial</a>.</dd>
|
||
|
|
||
|
<dt><a href="SearchableDictionary/index.html">Searchable Dictionary</a></dt>
|
||
|
<dd>A sample application that demonstrates Android's search framework,
|
||
|
including how to provide search suggestions for Quick Search Box.</dd>
|
||
|
|
||
|
<dt><a href="Snake/index.html">Snake</a></dt>
|
||
|
<dd>An implementation of the classic game "Snake."</dd>
|
||
|
|
||
|
<dt><a href="SoftKeyboard/index.html">Soft Keyboard</a></dt>
|
||
|
<dd>An example of writing an input method for a software keyboard.</dd>
|
||
|
|
||
|
</dl>
|
||
|
|
||
|
|
||
|
<div class="special">
|
||
|
<p>For more sample applications, check out
|
||
|
<a href="http://code.google.com/p/apps-for-android/">apps-for-android</a>, a
|
||
|
collection of open source applications that demonstrate various Android APIs.
|
||
|
</p>
|
||
|
</div>
|
||
|
|
||
|
|