Skip to content

Commit 3f23b71

Browse files
scottamainAndroid Git Automerger
authored andcommitted
am 5f25707: Merge "docs: add 101 Training class "Building Your First App"" into ics-mr1
* commit '5f2570773d9b4d7d55b9bac5c9fafb56e1dcce88': docs: add 101 Training class "Building Your First App"
2 parents 014ac37 + 5f25707 commit 3f23b71

File tree

13 files changed

+1057
-2
lines changed

13 files changed

+1057
-2
lines changed

docs/html/guide/topics/ui/declaring-layout.jd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ contains property types that define the size and position for each child view, a
194194
appropriate for the view group. As you can see in figure 1, the parent
195195
view group defines layout parameters for each child view (including the child view group).</p>
196196

197-
<img src="{@docRoot}images/layoutparams.png" alt="" height="300" align="center"/>
197+
<img src="{@docRoot}images/layoutparams.png" alt="" />
198198
<p class="img-caption"><strong>Figure 1.</strong> Visualization of a view hierarchy with layout
199199
parameters associated with each view.</p>
200200

docs/html/guide/topics/ui/index.jd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ as shown in the diagram below. This hierarchy tree can be as simple or complex a
5151
can build it up using Android's set of predefined widgets and layouts, or with custom Views that you
5252
create yourself.</p>
5353

54-
<img src="{@docRoot}images/viewgroup.png" alt="" width="312" height="211" align="center"/>
54+
<img src="{@docRoot}images/viewgroup.png" alt="" />
5555

5656
<p>
5757
In order to attach the view hierarchy tree to the screen for rendering, your Activity must call the

docs/html/images/layoutparams.png

19 KB
Loading
53.2 KB
Loading
7.25 KB
Loading
7.23 KB
Loading
36.3 KB
Loading

docs/html/images/viewgroup.png

10.5 KB
Loading

docs/html/training/basics/firstapp/building-ui.jd

Lines changed: 363 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
page.title=Creating an Android Project
2+
parent.title=Building Your First App
3+
parent.link=index.html
4+
5+
trainingnavtop=true
6+
next.title=Running Your App
7+
next.link=running-app.html
8+
9+
@jd:body
10+
11+
12+
<!-- This is the training bar -->
13+
<div id="tb-wrapper">
14+
<div id="tb">
15+
16+
<h2>This lesson teaches you to</h2>
17+
18+
<ol>
19+
<li><a href="#Eclipse">Create a Project with Eclipse</a></li>
20+
<li><a href="#CommandLine">Create a Project with Command Line Tools</a></li>
21+
</ol>
22+
23+
<h2>You should also read</h2>
24+
25+
<ul>
26+
<li><a href="{@docRoot}sdk/installing.html">Installing the
27+
SDK</a></li>
28+
<li><a href="{@docRoot}guide/developing/projects/index.html">Managing Projects</a></li>
29+
</ul>
30+
31+
32+
</div>
33+
</div>
34+
35+
<p>An Android project contains all the files that comprise the source code for your Android
36+
app. The Android SDK tools make it easy to start a new Android project with a set of
37+
default project directories and files.</p>
38+
39+
<p>This lesson
40+
shows how to create a new project either using Eclipse (with the ADT plugin) or using the
41+
SDK tools from a command line.</p>
42+
43+
<p class="note"><strong>Note:</strong> You should already have the Android SDK installed, and if
44+
you're using Eclipse, you should have installed the <a
45+
href="{@docRoot}sdk/eclipse-adt.html">ADT plugin</a> as well. If you have not installed
46+
these, see <a href="{@docRoot}sdk/installing.html">Installing the Android SDK</a> and return here
47+
when you've completed the installation.</p>
48+
49+
50+
<h2 id="Eclipse">Create a Project with Eclipse</h2>
51+
52+
<div class="figure" style="width:416px">
53+
<img src="{@docRoot}images/training/firstapp/adt-firstapp-setup.png" alt="" />
54+
<p class="img-caption"><strong>Figure 1.</strong> The new project wizard in Eclipse.</p>
55+
</div>
56+
57+
<ol>
58+
<li>In Eclipse, select <strong>File &gt; New &gt; Project</strong>.
59+
The resulting dialog should have a folder labeled <em>Android</em>. (If you don’t see the
60+
<em>Android</em> folder,
61+
then you have not installed the ADT plugin&mdash;see <a
62+
href="{@docRoot}sdk/eclipse-adt.html#installing">Installing the ADT Plugin</a>).</li>
63+
<li>Open the <em>Android</em> folder, select <em>Android Project</em> and click
64+
<strong>Next</strong>.</li>
65+
<li>Enter a project name (such as "MyFirstApp") and click <strong>Next</strong>.</li>
66+
<li>Select a build target. This is the platform version against which you will compile your app.
67+
<p>We recommend that you select the latest version possible. You can still build your app to
68+
support older versions, but setting the build target to the latest version allows you to
69+
easily optimize your app for a great user experience on the latest Android-powered devices.</p>
70+
<p>If you don't see any built targets listed, you need to install some using the Android SDK
71+
Manager tool. See <a href="{@docRoot}sdk/installing.html#AddingComponents">step 4 in the
72+
installing guide</a>.</p>
73+
<p>Click <strong>Next</strong>.</p></li>
74+
<li>Specify other app details, such as the:
75+
<ul>
76+
<li><em>Application Name</em>: The app name that appears to the user. Enter "My First
77+
App".</li>
78+
<li><em>Package Name</em>: The package namespace for your app (following the same
79+
rules as packages in the Java programming language). Your package name
80+
must be unique across all packages installed on the Android system. For this reason, it's important
81+
that you use a standard domain-style package name that’s appropriate to your company or
82+
publisher entity. For
83+
your first app, you can use something like "com.example.myapp." However, you cannot publish your
84+
app using the "com.example" namespace.</li>
85+
<li><em>Create Activity</em>: This is the class name for the primary user activity in your
86+
app (an activity represents a single screen in your app). Enter "MyFirstActivity".</li>
87+
<li><em>Minimum SDK</em>: Select <em>4 (Android 1.6)</em>.
88+
<p>Because this version is lower than the build target selected for the app, a warning
89+
appears, but that's alright. You simply need to be sure that you don't use any APIs that require an
90+
<a href="{@docRoot}guide/appendix/api-levels.html">API level</a> greater than the minimum SDK
91+
version without first using some code to verify the device's system version (you'll see this in some
92+
other classes).</p>
93+
</li>
94+
</ul>
95+
<p>Click <strong>Finish</strong>.</p>
96+
</li>
97+
</ol>
98+
99+
<p>Your Android project is now set up with some default files and you’re ready to begin
100+
building the app. Continue to the <a href="running-app.html">next lesson</a>.</p>
101+
102+
103+
104+
<h2 id="CommandLine">Create a Project with Command Line Tools</h2>
105+
106+
<p>If you're not using the Eclipse IDE with the ADT plugin, you can instead create your project
107+
using the SDK tools in a command line:</p>
108+
109+
<ol>
110+
<li>Change directories into the Android SDK’s <code>tools/</code> path.</li>
111+
<li>Execute:
112+
<pre class="no-pretty-print">android list targets</pre>
113+
<p>This prints a list of the available Android platforms that you’ve downloaded for your SDK. Find
114+
the platform against which you want to compile your app. Make a note of the target id. We
115+
recommend that you select the highest version possible. You can still build your app to
116+
support older versions, but setting the build target to the latest version allows you to optimize
117+
your app for the latest devices.</p>
118+
<p>If you don't see any targets listed, you need to
119+
install some using the Android SDK
120+
Manager tool. See <a href="{@docRoot}sdk/installing.html#AddingComponents">step 4 in the
121+
installing guide</a>.</p></li>
122+
<li>Execute:
123+
<pre class="no-pretty-print">
124+
android create project --target &lt;target-id> --name MyFirstApp \
125+
--path &lt;path-to-workspace>/MyFirstApp --activity MyFirstActivity \
126+
--package com.example.myapp
127+
</pre>
128+
<p>Replace <code>&lt;target-id></code> with an id from the list of targets (from the previous step)
129+
and replace
130+
<code>&lt;path-to-workspace></code> with the location in which you want to save your Android
131+
projects.</p></li>
132+
</ol>
133+
134+
<p>Your Android project is now set up with several default configurations and you’re ready to begin
135+
building the app. Continue to the <a href="running-app.html">next lesson</a>.</p>
136+
137+
<p class="note"><strong>Tip:</strong> Add the <code>platform-tools/</code> as well as the
138+
<code>tools/</code> directory to your <code>PATH</code> environment variable.</p>
139+
140+
141+
142+

0 commit comments

Comments
 (0)