summaryrefslogtreecommitdiffstats
path: root/docs/html/guide/tutorials/notepad
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html/guide/tutorials/notepad')
-rw-r--r--docs/html/guide/tutorials/notepad/index.jd142
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex1.jd38
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex2.jd22
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex3.jd17
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-extra-credit.jd12
5 files changed, 186 insertions, 45 deletions
diff --git a/docs/html/guide/tutorials/notepad/index.jd b/docs/html/guide/tutorials/notepad/index.jd
new file mode 100644
index 0000000..6319fad
--- /dev/null
+++ b/docs/html/guide/tutorials/notepad/index.jd
@@ -0,0 +1,142 @@
+page.title=Notepad Tutorial
+@jd:body
+
+
+<p>This tutorial on writing a notepad application gives you a &quot;hands-on&quot; introduction
+to the Android framework and the tools you use to build applications on it.
+Starting from a preconfigured project file, it guides you through the process of
+developing a simple notepad application and provides concrete examples of how to
+set up the project, develop the application logic and user interface, and then
+compile and run the application. </p>
+
+<p>The tutorial presents the application development as a set of
+exercises (see below), each consisting of several steps. You should follow
+the steps in each exercise to gradually build and refine your
+application. The exercises explain each step in detail and provide all the
+sample code you need to complete the application. </p>
+
+<p>When you are finished with the tutorial, you will have created a functioning
+Android application and will have learned many of the most important
+concepts in Android development. If you want to add more complex features to
+your application, you can examine the code in an alternative implementation
+of a Note Pad application, in the
+<a href="{@docRoot}guide/samples/index.html">Sample Code</a> section. </p>
+
+
+<a name="who"></a>
+<h2>Who Should Use this Tutorial</h2>
+
+<p>This tutorial is designed for experienced developers, especially those with
+knowledge of the Java programming language. If you haven't written Java
+applications before, you can still use the tutorial, but you might need to work
+at a slower pace. </p>
+
+<p>Also note that this tutorial uses
+the Eclipse development environment, with the Android plugin installed. If you
+are not using Eclipse, you can follow the exercises and build the application,
+but you will need to determine how to accomplish the Eclipse-specific
+steps in your environment. </p>
+
+<a name="preparing"></a>
+<h2>Preparing for the Exercises</h2>
+
+<p>The tutorial assumes that you have some familiarity with basic Android
+application concepts and terminology. If you are not, you
+should read <a href="{@docRoot}guide/topics/fundamentals.html">Application
+Fundamentals</a> before continuing. </p>
+
+<p>This tutorial also builds on the introductory information provided in the
+<a href="{@docRoot}guide/tutorials/hello-world.html">Hello World</a>
+tutorial, which explains how to set up your Eclipse environment
+for building Android applications. We recommend you complete the Hello World
+tutorial before starting this one.</p>
+
+<p>To prepare for this lesson:</p>
+
+<ol>
+ <li>Download the <a href="codelab/NotepadCodeLab.zip">project
+ exercises archive (.zip)</a>.</li>
+ <li>Unpack the archive file to a suitable location on your machine.</li>
+ <li>Open the <code>NotepadCodeLab</code> folder.</li>
+</ol>
+
+<p>Inside the <code>NotepadCodeLab</code> folder, you should see six project
+files: <code>Notepadv1</code>,
+ <code>Notepadv2</code>, <code>Notepadv3</code>,
+ <code>Notepadv1Solution</code>, <code>Notepadv2Solution</code>
+ and <code>Notepadv3Solution</code>. The <code>Notepadv#</code> projects are
+the starting points for each of the exercises, while the
+<code>Notepadv#Solution</code> projects are the exercise
+ solutions. If you are having trouble with a particular exercise, you
+ can compare your current work against the exercise solution.</p>
+
+<a name="exercises"></a>
+<h2> Exercises</h2>
+
+ <p>The table below lists the tutorial exercises and describes the development
+areas that each covers. Each exercise assumes that you have completed any
+previous exercises.</p>
+
+ <table border="0" style="padding:4px;spacing:2px;" summary="This
+table lists the
+tutorial examples and describes what each covers. ">
+ <tr>
+ <th width="120"><a href="{@docRoot}guide/tutorials/notepad/notepad-ex1.html">Exercise
+1</a></th>
+ <td>Start here. Construct a simple notes list that lets the user add new notes but not
+edit them. Demonstrates the basics of <code>ListActivity</code> and creating
+and handling
+ menu options. Uses a SQLite database to store the notes.</td>
+ </tr>
+ <tr>
+ <th><a href="{@docRoot}guide/tutorials/notepad/notepad-ex2.html">Exercise 2</a></th>
+ <td>Add a second Activity to the
+application. Demonstrates constructing a
+new Activity, adding it to the Android manifest, passing data between the
+activities, and using more advanced screen layout. Also shows how to
+invoke another Activity to return a result, using
+<code>startActivityForResult()</code>.</td>
+ </tr>
+ <tr>
+ <th><a href="{@docRoot}guide/tutorials/notepad/notepad-ex3.html">Exercise 3</a></th>
+ <td>Add handling of life-cycle events to
+the application, to let it
+maintain application state across the life cycle. </td>
+ </tr>
+ <tr>
+ <th><a href="{@docRoot}guide/tutorials/notepad/notepad-extra-credit.html">Extra
+Credit</a></th>
+ <td>Demonstrates how to use the Eclipse
+debugger and how you can use it to
+view life-cycle events as they are generated. This section is optional but
+highly recommended.</td>
+ </tr>
+</table>
+
+
+<a name="other"></a>
+<h2>Other Resources and Further Learning</h2>
+<ul>
+<li>For a lighter but broader introduction to concepts not covered in the
+tutorial,
+take a look at <a href="{@docRoot}guide/appendix/faq/commontasks.html">Common Android Tasks</a>.</li>
+<li>The Android SDK includes a variety of fully functioning sample applications
+that make excellent opportunities for further learning. You can find the sample
+applications in the <code>samples/</code> directory of your downloaded SDK, or browser them
+here, in the <a href="{@docRoot}guide/samples/index.html">Sample Code</a> section.</li>
+<li>This tutorial draws from the full Notepad application included in the
+<code>samples/</code> directory of the SDK, though it does not match it exactly.
+When you are done with the tutorial,
+it is highly recommended that you take a closer look at this version of the Notepad
+application,
+as it demonstrates a variety of interesting additions for your application,
+such as:</li>
+ <ul>
+ <li>Setting up a custom striped list for the list of notes.</li>
+ <li>Creating a custom text edit view that overrides the <code>draw()</code>
+ method to make it look like a lined notepad.</li>
+ <li>Implementing a full <code>ContentProvider</code> for notes.</li>
+ <li>Reverting and discarding edits instead of just automatically saving
+ them.</li>
+ </ul>
+</ul>
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex1.jd b/docs/html/guide/tutorials/notepad/notepad-ex1.jd
index 715267f..45ed97e 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex1.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex1.jd
@@ -17,10 +17,10 @@ selections. </em></li>
<div style="float:right;white-space:nowrap">
<span style="color:#BBB;">
- [<a href="tutorial-ex1.html" style="color:#BBB;">Exercise 1</a>]</span>
- [<a href="tutorial-ex2.html">Exercise 2</a>]
- [<a href="tutorial-ex3.html">Exercise 3</a>]
- [<a href="tutorial-extra-credit.html">Extra Credit</a>]
+ [<a href="notepad-ex1.html" style="color:#BBB;">Exercise 1</a>]</span>
+ [<a href="notepad-ex2.html">Exercise 2</a>]
+ [<a href="notepad-ex3.html">Exercise 3</a>]
+ [<a href="notepad-extra-credit.html">Extra Credit</a>]
</div>
@@ -31,8 +31,8 @@ selections. </em></li>
<p><code>Notepadv1</code> is a project that is provided as a starting point. It
takes care of some of the boilerplate work that you have already seen if you
- followed the <a href="{@docRoot}intro/hello-android.html">Hello
- Android tutorial.</a></p>
+ followed the <a href="{@docRoot}guide/tutorials/hello-world.html">Hello,
+ World</a> tutorial.</p>
<ol>
<li>
@@ -42,7 +42,7 @@ selections. </em></li>
In the New Android Project dialog, select <strong>Create project from existing source</strong>.</li>
<li>
Click <strong>Browse</strong> and navigate to where you copied the <code>NotepadCodeLab</code>
- (downloaded during <a href="/android/intro/tutorial.html#preparing">setup</a>). Select
+ (downloaded during <a href="{@docRoot}guide/tutorials/notepad/index.html#preparing">setup</a>). Select
<code>Notepadv1</code> and click <strong>Choose</strong>.</li>
<li>
You should see <code>Notepadv1</code> in the <em>Project name</em> and also see the <em>Location</em>
@@ -72,8 +72,8 @@ selections. </em></li>
{@link android.content.ContentProvider ContentProvider}.</p>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">If you are interested, you can find out more about
- <a href="{@docRoot}devel/data/contentproviders.html">content providers</a> or the whole
- subject of <a href="{@docRoot}devel/data.html">Storing, Retrieving, and Exposing Data</a>.
+ <a href="{@docRoot}guide/topics/providers/content-providers.html">content providers</a> or the whole
+ subject of <a href="{@docRoot}guide/topics/data/data-storage.html">Data Storage</a>.
The NotePad sample in the <code>samples/</code> folder of the SDK also has an example of how
to create a ContentProvider.</p>
</div>
@@ -145,9 +145,9 @@ selections. </em></li>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">Full screen layouts are not the only option for an Activity however. You
might also want to use a <a
-href="{@docRoot}kb/commontasks.html#floatingorfull">floating
+href="{@docRoot}guide/appendix/faq/commontasks.html#floatingorfull">floating
layout</a> (for example, a <a
-href="{@docRoot}kb/commontasks.html#dialogsandalerts">dialog
+href="{@docRoot}guide/appendix/faq/commontasks.html#dialogsandalerts">dialog
or alert</a>),
or perhaps you don't need a layout at all (the Activity will be invisible
to the user unless you specify some kind of layout for it to use).</p>
@@ -236,7 +236,7 @@ and
background-color:#FFFFDD;">Resources and the R class</h2>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">The folders under res/ in the Eclipse project are for resources.
- There is a <a href="{@docRoot}kb/commontasks.html#filelist">specific structure</a> to the
+ There is a <a href="{@docRoot}guide/appendix/faq/commontasks.html#filelist">specific structure</a> to the
folders and files under res/.</p>
<p style="padding-left:.5em;font-size:12px;
margin:0; padding:.0em .5em .5em 1em;">Resources defined in these folders and files will have
@@ -330,7 +330,7 @@ Notepadv1
titles:</p>
<ol>
<li>
- In the <code>onCreate</code> method, call <code>super()</code> with the
+ In the <code>onCreate</code> method, call <code>super.onCreate()</code> with the
<code>savedInstanceState</code> parameter that's passed in.</li>
<li>
Call <code>setContentView()</code> and pass <code>R.layout.notepad_list</code>.</li>
@@ -376,11 +376,11 @@ Notepadv1
background-color:#FFFFDD;">More on menus</h2>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">The notepad application we are constructing only scratches the
- surface with <a href="{@docRoot}kb/commontasks.html#addmenuitems">menus</a>. </p>
+ surface with <a href="{@docRoot}guide/appendix/faq/commontasks.html#addmenuitems">menus</a>. </p>
<p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">You can also <a href="{@docRoot}kb/commontasks.html#menukeyshortcuts">add
-shortcut keys for menu items</a>, <a href="{@docRoot}kb/commontasks.html#menukeyshortcuts">create
-submenus</a> and even <a href="{@docRoot}kb/commontasks.html#addingtoothermenus">add
+ padding:.0em .5em .5em 1em;">You can also <a href="{@docRoot}guide/appendix/faq/commontasks.html#menukeyshortcuts">add
+shortcut keys for menu items</a>, <a href="{@docRoot}guide/appendix/faq/commontasks.html#menukeyshortcuts">create
+submenus</a> and even <a href="{@docRoot}guide/appendix/faq/commontasks.html#addingtoothermenus">add
menu items to other applications!</a>. </p>
</div>
@@ -582,7 +582,7 @@ We will simply
from
the zip file to compare with your own.</p>
-<p>Once you are ready, move on to <a href="tutorial-ex2.html">Tutorial
+<p>Once you are ready, move on to <a href="notepad-ex2.html">Tutorial
Exercise 2</a> to add the ability to create, edit and delete notes.</p>
-<p><a href="tutorial.html">Back to the Tutorial main page...</a></p>
+<p><a href="index.html">Back to the Tutorial main page...</a></p>
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex2.jd b/docs/html/guide/tutorials/notepad/notepad-ex2.jd
index ce7681b..b4608fb 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex2.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex2.jd
@@ -14,12 +14,12 @@ demonstrates:</em></p>
</ul>
<div style="float:right;white-space:nowrap">
- [<a href="tutorial-ex1.html">Exercise 1</a>]
+ [<a href="notepad-ex1.html">Exercise 1</a>]
<span style="color:#BBB;">
- [<a href="tutorial-ex2.html" style="color:#DDD;">Exercise 2</a>]
+ [<a href="notepad-ex2.html" style="color:#DDD;">Exercise 2</a>]
</span>
- [<a href="tutorial-ex3.html">Exercise 3</a>]
- [<a href="tutorial-extra-credit.html">Extra Credit</a>]
+ [<a href="notepad-ex3.html">Exercise 3</a>]
+ [<a href="notepad-extra-credit.html">Extra Credit</a>]
</div>
<h2>Step 1</h2>
@@ -122,7 +122,7 @@ public boolean onMenuItemSelected(int featureId, MenuItem item) {
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">In this example our Intent uses a class name specifically.
As well as
- <a href="{@docRoot}kb/commontasks.html#intentexamples">starting intents</a> in
+ <a href="{@docRoot}guide/appendix/faq/commontasks.html#intentexamples">starting intents</a> in
classes we already know about, be they in our own application or another
application, we can also create Intents without knowing exactly which
application will handle it.</p>
@@ -295,11 +295,11 @@ case ACTIVITY_EDIT:
in real Android applications.</p>
<p style="padding-left:.5em;font-size:12px;margin:0; padding:.0em .5em .5em 1em;">Creating a
good UI is part art and part science, and the rest is work. Mastering <a
- href="{@docRoot}devel/implementing-ui.html">Android layout</a> is an essential part of creating
+ href="{@docRoot}guide/topics/views/declaring-layout.html">Android layout</a> is an essential part of creating
a good looking Android application.</p>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">Take a look at the
- <a href="{@docRoot}reference/view-gallery.html">View Gallery</a>
+ <a href="{@docRoot}guide/tutorials/views/index.html">Hello Views</a>
for some example layouts and how to use them. The ApiDemos sample project is also a
great resource from which to learn how to create different layouts.</p>
</div>
@@ -459,7 +459,7 @@ confirmButton.setOnClickListener(new View.OnClickListener() {
</ol>
<h2>Step 10</h2>
-<p>Fill in the body of the <code>onClick()</code> method in our listener.</p>
+<p>Fill in the body of the <code>onClick()</code> method of the <code>OnClickListener</code> created in the last step.</p>
<p>This is the code that will be run when the user clicks on the
confirm button. We want this to grab the title and body text from the edit
@@ -570,7 +570,7 @@ protected void onCreate(Bundle savedInstanceState) {
receive, and more. </p>
<p style="padding-left:.5em;font-size:12px;margin:0;
padding:.0em .5em .5em 1em;">For more information, see the reference document
- <a href="{@docRoot}devel/bblocks-manifest.html">AndroidManifest.xml</a></p>
+ <a href="{@docRoot}guide/topics/manifest/manifest.html">AndroidManifest.xml</a></p>
</div>
<p>Finally, the new Activity has to be defined in the manifest file:</p>
@@ -632,9 +632,9 @@ your changes have been lost. In the next exercise we will fix these
problems.</p>
<p>
-Once you are ready, move on to <a href="tutorial-ex3.html">Tutorial
+Once you are ready, move on to <a href="notepad-ex3.html">Tutorial
Exercise 3</a> where you will fix the problems with the back button and lost
edits by introducing a proper life cycle into the NoteEdit Activity.</p>
-<p><a href="tutorial.html">Back to the Tutorial main page...</a>.</p>
+<p><a href="index.html">Back to the Tutorial main page...</a>.</p>
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex3.jd b/docs/html/guide/tutorials/notepad/notepad-ex3.jd
index b42734f..a2eaa48 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex3.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex3.jd
@@ -10,12 +10,12 @@ retrieve application state data. This exercise demonstrates:</em></p>
</ul>
<div style="float:right;white-space:nowrap">
- [<a href="tutorial-ex1.html">Exercise 1</a>]
- [<a href="tutorial-ex2.html">Exercise 2</a>]
+ [<a href="notepad-ex1.html">Exercise 1</a>]
+ [<a href="notepad-ex2.html">Exercise 2</a>]
<span style="color:#BBB;">
- [<a href="tutorial-ex3.html" style="color:#BBB;">Exercise 3</a>]
+ [<a href="notepad-ex3.html" style="color:#BBB;">Exercise 3</a>]
</span>
- [<a href="tutorial-extra-credit.html">Extra Credit</a>]
+ [<a href="notepad-extra-credit.html">Extra Credit</a>]
</div>
<h2>Step 1</h2>
@@ -200,8 +200,8 @@ and populate the View elements with them.</p>
have to store enough state to come back up later, preferably in the same
state it was in when it was killed.</p>
<p style="padding-left:.5em;font-size:12px;margin:0;padding:.0em .5em .5em 1em;">
- Android has a <a href="{@docRoot}intro/lifecycle.html">well-defined life cycle</a>.
- Life-cycle events can happen even if you are not handing off control to
+ Android has a <a href="{@docRoot}guide/topics/fundamentals.html#lcycles">well-defined life cycle</a>.
+ Lifecycle events can happen even if you are not handing off control to
another Activity explicitly. For example, perhaps a call comes in to the
handset. If this happens, and your Activity is running, it will be swapped
out while the call Activity takes over.</p>
@@ -351,8 +351,7 @@ click menu again)</p>
from
the zip file to compare with your own.</p>
<p>
-When you are ready, move on to the <a href="{@docRoot}intro/tutorial-extra-credit.html">Tutorial
+When you are ready, move on to the <a href="notepad-extra-credit.html">Tutorial
Extra Credit</a> exercise, where you can use the Eclipse debugger to
examine the life-cycle events as they happen.</p>
-<p><a href="{@docRoot}intro/tutorial.html">Back to the Tutorial main
-page...</a></p>
+<p><a href="index.html">Back to the Tutorial main page...</a></p>
diff --git a/docs/html/guide/tutorials/notepad/notepad-extra-credit.jd b/docs/html/guide/tutorials/notepad/notepad-extra-credit.jd
index 9ab84ce..f64e90e 100644
--- a/docs/html/guide/tutorials/notepad/notepad-extra-credit.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-extra-credit.jd
@@ -11,11 +11,11 @@ in Exercise 3. This exercise demonstrates:</em></p>
<div style="float:right;white-space:nowrap">
- [<a href="tutorial-ex1.html">Exercise 1</a>]
- [<a href="tutorial-ex2.html">Exercise 2</a>]
- [<a href="tutorial-ex3.html">Exercise 3</a>]
+ [<a href="notepad-ex1.html">Exercise 1</a>]
+ [<a href="notepad-ex2.html">Exercise 2</a>]
+ [<a href="notepad-ex3.html">Exercise 3</a>]
<span style="color:#BBB;">
- [<a href="tutorial-extra-credit.html" style="color:#BBB;">Extra Credit</a>]
+ [<a href="notepad-extra-credit.html" style="color:#BBB;">Extra Credit</a>]
</span>
</div>
@@ -63,8 +63,8 @@ when.</p>
<p>The Android Eclipse plugin not only offers excellent debugging support for
your application development, but also superb profiling support. You can also
-try using <a href="{@docRoot}reference/traceview.html">Traceview</a> to profile your application. If your application is running too slow, this can help you
+try using <a href="{@docRoot}guide/developing/tools/traceview.html">Traceview</a> to profile your application. If your application is running too slow, this can help you
find the bottlenecks and fix them.</p>
-<p><a href="{@docRoot}intro/tutorial.html">Back to the Tutorial main
+<p><a href="index.html">Back to the Tutorial main
page...</a></p>