7cc83988d3
b/18591448 Change-Id: Ie69d3391bd45ec3b4c2bccc8eb86e5f28290f686
76 lines
2.9 KiB
Plaintext
76 lines
2.9 KiB
Plaintext
page.title=Samples
|
|
page.tags="examples","code"
|
|
|
|
@jd:body
|
|
|
|
|
|
<p>Welcome to code samples for Android developers. Here you can browse sample code and learn how to
|
|
build different components for your applications. Use the categories on the left to browse the
|
|
available samples.</p>
|
|
|
|
<p>Each sample is a fully functioning Android app. You can browse the resources, source files and
|
|
see the overall project structure. You can copy and paste the code you need, and if you want to
|
|
share a link to a specific line you can double-click it to the get the URL.</p>
|
|
|
|
|
|
<h2>Import Samples from GitHub</h2>
|
|
|
|
<p>Android Studio provides easy access to import Android code samples from GitHub and is the
|
|
recommended method to retrieve Android code samples.</p>
|
|
|
|
<p>To import a code sample into Android Studio:<p>
|
|
|
|
<ol>
|
|
<li>In the Android Studio menu, select <strong>File > Import Sample</strong> to open the
|
|
Import Sample wizard.</li>
|
|
<li>Select a sample to import and click <strong>Next</strong>.</li>
|
|
<li>Specify the application name and project location if different from the displayed settings.</li>
|
|
<li>Click <strong>Finish</strong>.
|
|
<p>The sample project opens in a new Android Studio project.</p></li>
|
|
</ol>
|
|
|
|
<p class="note">
|
|
<strong>Note:</strong> When starting Android Studio, you can also select <strong>Import an
|
|
Android code sample</strong> in the Welcome to Android Studio wizard to import a sample project
|
|
from GitHub as a new project.
|
|
</p>
|
|
|
|
<p>For more information about importing samples, see
|
|
<a href="{@docRoot}tools/studio/index.html#git-samples">Easy access to Android code samples on
|
|
GitHub</a>.</p>
|
|
|
|
<h2>Download Samples</h2>
|
|
|
|
<p>Although importing samples from Android Studio is the recommended method, you can also use the
|
|
categories on the left to browse the available samples and learn how to build different components
|
|
for your applications.</p>
|
|
|
|
<p>If you want to download a complete project, just click on any source file in the project and
|
|
click the <strong>Download</strong> link in the upper right of the source page.</p>
|
|
|
|
<p>To import a downloaded project:<p>
|
|
|
|
<ol>
|
|
<li>Unpack the downloaded project package.</li>
|
|
<li>In <a href="{@docRoot}sdk/installing/studio.html">Android Studio</a>, chose
|
|
<strong>File > Import Project</strong> and select the root folder of the unpacked project.
|
|
<p>Android Studio may ask you to choose the type of project you are importing.
|
|
If this is the case, make sure to choose <strong>Import project from
|
|
external model</strong> and select the <strong>Gradle</strong> option.
|
|
</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p class="note">
|
|
<strong>Note:</strong> When starting Android Studio, you can also select <strong>Import
|
|
Non-Android Studio project</strong> in the Welcome to Android Studio wizard to import a
|
|
downloaded sample project.
|
|
</p>
|
|
|
|
|
|
<p class="note">
|
|
<strong>Note:</strong> At this time, the downloadable projects are designed for use with Gradle
|
|
and Android Studio.
|
|
</p>
|
|
|