Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f38122da authored by Rich Slogar's avatar Rich Slogar Committed by Android Git Automerger
Browse files

am 48fc1d7b: Merge "docs: studio sample procedure update" into lmp-docs

* commit '48fc1d7b':
  docs: studio sample procedure update
parents d5a114cd 48fc1d7b
Loading
Loading
Loading
Loading
+47 −17
Original line number Diff line number Diff line
@@ -4,30 +4,56 @@ 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>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>
share a link to a specific line you can double-click it to the get the URL.</p>

<p>If you want to download a complete project, just click on any source file in the project and
  click the link in the upper right of the source page.</p>

<p>To import a downloaded project:<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 &gt; 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>

<div class="toggle-content closed">
<p style="margin-top:5px"><a href="#" onclick="return toggleContent(this)">
  <img src="/assets/images/triangle-closed.png" class="toggle-content-img" alt=""
  />Using Android Studio</a></p>
<h2>Download Samples</h2>

  <div class="toggle-content-toggleme">
<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.
    <strong>File &gt; 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.
@@ -35,11 +61,15 @@ page.tags="examples","code"
    </li>
  </ol>

  </div>
</div>
<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. Project downloads for Eclipse will be available soon!
    and Android Studio. 
</p>
+6 −1
Original line number Diff line number Diff line
@@ -410,9 +410,14 @@ UI versions). Also, the new drawable XML tags and attributes, such as &lt;ripple
and &lt;animated-selector&gt;, are supported.</p>


<h3> Easy access to Android code samples on GitHub</h3>
<h3 id="git-samples"> Easy access to Android code samples on GitHub</h3>
<p>Clicking <strong>Import Samples</strong> from the <strong>File</strong> menu or Welcome page
provides seamless access to Google code samples on GitHub.</p>
    <p><img src="{@docRoot}images/tools/studio-samples-githubaccess.png" /></p>
    <p class="img-caption"><strong>Figure 12.</strong> Code Sample Access</p>


    <p><img src="{@docRoot}images/tools/studio-sample-in-editor.png" /></p>
    <p class="img-caption"><strong>Figure 13.</strong> Imported Code Sample</p>