summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Main <smain@google.com>2010-03-24 17:18:01 -0700
committerScott Main <smain@google.com>2010-03-24 17:18:01 -0700
commitf54574a90cb2c09af7fb5518e3e859726ce75027 (patch)
tree073fb9f07a2ddee1948e440b48bc87fcb825ed90
parent69c997a5c603c3cc56cbfdacd72cbe9993c5f053 (diff)
downloadframeworks_base-f54574a90cb2c09af7fb5518e3e859726ce75027.zip
frameworks_base-f54574a90cb2c09af7fb5518e3e859726ce75027.tar.gz
frameworks_base-f54574a90cb2c09af7fb5518e3e859726ce75027.tar.bz2
docs: clean docs to use consistent "sidebox" classes (eliminate sidebox-inner)
Change-Id: I8a2a343257b055b5447bca03a98e48ad4387ff42
-rw-r--r--docs/html/guide/appendix/g-app-intents.jd5
-rw-r--r--docs/html/guide/developing/device.jd2
-rw-r--r--docs/html/guide/developing/tools/avd.jd2
-rw-r--r--docs/html/guide/topics/appwidgets/index.jd2
-rw-r--r--docs/html/guide/topics/fundamentals.jd2
-rw-r--r--docs/html/guide/topics/intents/intents-filters.jd2
-rw-r--r--docs/html/guide/topics/ui/index.jd2
-rw-r--r--docs/html/guide/topics/ui/layout-objects.jd2
-rw-r--r--docs/html/guide/topics/wireless/bluetooth.jd6
-rw-r--r--docs/html/guide/tutorials/hello-world.jd10
-rw-r--r--docs/html/guide/tutorials/notepad/index.jd16
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex1.jd95
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex2.jd150
-rw-r--r--docs/html/guide/tutorials/notepad/notepad-ex3.jd125
-rw-r--r--docs/html/intl/ja/guide/publishing/preparing.jd8
-rw-r--r--docs/html/intl/ja/guide/topics/fundamentals.jd2
-rw-r--r--docs/html/intl/ja/guide/tutorials/hello-world.jd7
-rw-r--r--docs/html/intl/ja/resources/tutorials/hello-world.jd6
-rw-r--r--docs/html/resources/tutorials/hello-world.jd4
-rw-r--r--docs/html/sdk/1.1_r1/upgrading.jd2
-rw-r--r--docs/html/sdk/installing.jd2
-rw-r--r--docs/html/sdk/win-usb.jd2
22 files changed, 231 insertions, 223 deletions
diff --git a/docs/html/guide/appendix/g-app-intents.jd b/docs/html/guide/appendix/g-app-intents.jd
index 2846859..df9d29b 100644
--- a/docs/html/guide/appendix/g-app-intents.jd
+++ b/docs/html/guide/appendix/g-app-intents.jd
@@ -1,8 +1,11 @@
page.title=Intents List: Invoking Google Applications on Android Devices
@jd:body
+<div class="sidebox-wrapper">
<div class="sidebox">
-For more information about intents, see the <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a>.
+For more information about intents, see the <a
+href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a>.
+</div>
</div>
<p>The table below lists the intents that your application can send, to invoke Google applications on Android devices in certain ways. For each action/uri pair, the table describes how the receiving Google application handles the intent. </p>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index 8fa4cec..22c099f 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -55,7 +55,7 @@ you'll need a developer device such as the <a href="#dev-phone-1">Android Dev Ph
<h3 id="dev-phone-1">Android Dev Phone 1</h3>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<p>Selected specs for Android Dev Phone 1:</p>
<ul>
<li>Touch screen</li>
diff --git a/docs/html/guide/developing/tools/avd.jd b/docs/html/guide/developing/tools/avd.jd
index 06b1245..acebb7e 100644
--- a/docs/html/guide/developing/tools/avd.jd
+++ b/docs/html/guide/developing/tools/avd.jd
@@ -93,7 +93,7 @@ Other IDEs</a>, as appropriate for your environment.</p>
<h2 id="creating">Creating an AVD</h2>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<p>The Android SDK does not include any preconfigured AVDs, so
you need to create an AVD before you can run any application in the emulator
(even the Hello World application).</p>
diff --git a/docs/html/guide/topics/appwidgets/index.jd b/docs/html/guide/topics/appwidgets/index.jd
index f36b684..7a8dd59 100644
--- a/docs/html/guide/topics/appwidgets/index.jd
+++ b/docs/html/guide/topics/appwidgets/index.jd
@@ -220,7 +220,7 @@ following layout classes:</p>
<h2 id="AppWidgetProvider">Using the AppWidgetProvider Class</h2>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+<div class="sidebox">
<p>You must declare your AppWidgetProvider class implementation as a broadcast receiver
using the <code>&lt;receiver></code> element in the AndroidManifest (see
<a href="#Manifest">Declaring an App Widget in the Manifest</a> above).</p>
diff --git a/docs/html/guide/topics/fundamentals.jd b/docs/html/guide/topics/fundamentals.jd
index c10af8e..807c7ff 100644
--- a/docs/html/guide/topics/fundamentals.jd
+++ b/docs/html/guide/topics/fundamentals.jd
@@ -1180,7 +1180,7 @@ to commit data changes and otherwise prepare to stop interacting with the user.
</p>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<h2>Calling into the superclass</h2>
<p>
An implementation of any activity lifecycle method should always first
diff --git a/docs/html/guide/topics/intents/intents-filters.jd b/docs/html/guide/topics/intents/intents-filters.jd
index 110721d..bd1d694 100644
--- a/docs/html/guide/topics/intents/intents-filters.jd
+++ b/docs/html/guide/topics/intents/intents-filters.jd
@@ -392,7 +392,7 @@ section, later.)
</p>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<h2>Filters and security</h2>
<p>An intent filter cannot be relied on for security. While it opens a
component to receiving only certain kinds of implicit intents, it does
diff --git a/docs/html/guide/topics/ui/index.jd b/docs/html/guide/topics/ui/index.jd
index 494bda8..abcf6be 100644
--- a/docs/html/guide/topics/ui/index.jd
+++ b/docs/html/guide/topics/ui/index.jd
@@ -107,7 +107,7 @@ complex layout.</p>
<p>For more on building a UI layout, read <a href="declaring-layout.html">Declaring Layout</a>.
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<p><b>Tip:</b> You can also draw View and ViewGroups objects in Java code,
using the <code>{@link android.view.ViewGroup#addView(View)}</code> methods
to dynamically insert new View and ViewGroup objects.</p>
diff --git a/docs/html/guide/topics/ui/layout-objects.jd b/docs/html/guide/topics/ui/layout-objects.jd
index 345e9b3..8b2792d 100644
--- a/docs/html/guide/topics/ui/layout-objects.jd
+++ b/docs/html/guide/topics/ui/layout-objects.jd
@@ -55,6 +55,7 @@ If the third box is then given a weight of 2 (instead of 0), then it is now decl
"more important" than both the others, so it gets half the total remaining space, while the first two
share the rest equally.</p>
+<div class="sidebox-wrapper">
<div class="sidebox">
<p><strong>Tip</strong>: To create a proportionate size
layout on the screen, create a container view group object with the
@@ -64,6 +65,7 @@ the children <code>height</code> or <code>width</code> to <code>0</code> (zero);
to each child, depending on what proportion of the screen each should
have.</p>
</div>
+</div>
<p>The following two forms represent a {@link android.widget.LinearLayout LinearLayout} with a set of elements: a
button, some labels and text boxes. The text boxes have their width set to <var>fill_parent</var>; other
diff --git a/docs/html/guide/topics/wireless/bluetooth.jd b/docs/html/guide/topics/wireless/bluetooth.jd
index 80aa0d7..a8ff007 100644
--- a/docs/html/guide/topics/wireless/bluetooth.jd
+++ b/docs/html/guide/topics/wireless/bluetooth.jd
@@ -466,7 +466,8 @@ android.bluetooth.BluetoothServerSocket},
the {@link android.bluetooth.BluetoothServerSocket} can (and should) be
discarded, unless you want to accept more connections.</p>
-<div class="sidebox-wrapper"><div class="sidebox-inner">
+<div class="sidebox-wrapper">
+<div class="sidebox">
<h2>About UUID</h2>
<p>A Universally Unique Identifier (UUID) is a standardized 128-bit format for a string
@@ -476,7 +477,8 @@ used to uniquely identify your application's Bluetooth service. To get a UUID to
use with your application, you can use one of the many random UUID generators on
the web, then initialize a {@link java.util.UUID} with {@link
java.util.UUID#fromString(String)}.</p>
-</div></div>
+</div>
+</div>
<p>Here's the basic procedure to set up a server socket and accept a
connection:</p>
diff --git a/docs/html/guide/tutorials/hello-world.jd b/docs/html/guide/tutorials/hello-world.jd
index f6b54ff..6e315b2 100644
--- a/docs/html/guide/tutorials/hello-world.jd
+++ b/docs/html/guide/tutorials/hello-world.jd
@@ -35,7 +35,7 @@ here when you've completed the installation.</p>
<h2 id="avd">Create an AVD</h2>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>To learn more about how to use AVDs and the options
available to you, refer to the
<a href="{@docRoot}guide/developing/tools/avd.html">Android
@@ -243,7 +243,7 @@ to see it running.</p>
</ol>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>To learn more about creating and editing run configurations in Eclipse, refer to
<a href="{@docRoot}guide/developing/eclipse-adt.html#RunConfig">Developing In Eclipse,
with ADT</a>.</p>
@@ -357,12 +357,14 @@ short for "resources" and the directory contains all the non-code assets that
your application requires. In addition to layout files, resources also include assets
such as images, sounds, and localized strings.</p>
+<div class="sidebox-wrapper">
<div class="sidebox">
<h2>Landscape layout</h2>
<p>When you want a different design for landscape, put your layout XML file
inside /res/layout-land. Android will automatically look here when the layout changes.
Without this special landscape layout defined, Android will stretch the default layout.</p>
</div>
+</div>
<p>The Eclipse plugin automatically creates one of these layout files for you: main.xml.
In the "Hello World" application you just completed, this file was ignored and you created a
@@ -478,12 +480,12 @@ particularly powerful with the code-completion features of IDEs like Eclipse
because it lets you quickly and interactively locate the specific reference
you're looking for.</p>
-<p>It's possible yours looks slightly different than this (perhaps the hexadecimal values are different).
+<p>It's possible yours looks slighly different than this (perhaps the hexadecimal values are different).
For now, notice the inner class named "layout", and its
member field "main". The Eclipse plugin noticed the XML
layout file named main.xml and generated a class for it here. As you add other
resources to your project (such as strings in the <code>res/values/string.xml</code> file or drawables inside
-the <code>res/drawable/</code> directory) you'll see <code>R.java</code> change to keep up.</p>
+the <code>res/drawable/</code> direcory) you'll see <code>R.java</code> change to keep up.</p>
<p>When not using Eclipse, this class file will be generated for you at build time (with the Ant tool).</p>
<p><em>You should never edit this file by hand.</em></p>
</div>
diff --git a/docs/html/guide/tutorials/notepad/index.jd b/docs/html/guide/tutorials/notepad/index.jd
index 6319fad..f569314 100644
--- a/docs/html/guide/tutorials/notepad/index.jd
+++ b/docs/html/guide/tutorials/notepad/index.jd
@@ -20,7 +20,7 @@ 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 href="{@docRoot}resources/samples/index.html">Sample Code</a> section. </p>
<a name="who"></a>
@@ -46,7 +46,7 @@ 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>
+<a href="{@docRoot}resources/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>
@@ -81,7 +81,7 @@ previous exercises.</p>
table lists the
tutorial examples and describes what each covers. ">
<tr>
- <th width="120"><a href="{@docRoot}guide/tutorials/notepad/notepad-ex1.html">Exercise
+ <th width="120"><a href="{@docRoot}resources/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
@@ -89,7 +89,7 @@ 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>
+ <th><a href="{@docRoot}resources/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
@@ -98,13 +98,13 @@ 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>
+ <th><a href="{@docRoot}resources/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
+ <th><a href="{@docRoot}resources/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
@@ -119,11 +119,11 @@ highly recommended.</td>
<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>
+take a look at <a href="{@docRoot}resources/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>
+here, in the <a href="{@docRoot}resources/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,
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex1.jd b/docs/html/guide/tutorials/notepad/notepad-ex1.jd
index b5173b8..cf7765e 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex1.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex1.jd
@@ -33,7 +33,7 @@ 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}guide/tutorials/hello-world.html">Hello,
+ followed the <a href="{@docRoot}resources/tutorials/hello-world.html">Hello,
World</a> tutorial.</p>
<ol>
@@ -44,7 +44,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="{@docRoot}guide/tutorials/notepad/index.html#preparing">setup</a>)
+ (downloaded during <a href="{@docRoot}resources/tutorials/notepad/index.html#preparing">setup</a>)
and select <code>Notepadv1</code>.</li>
<li>
The Project Name and other properties should be automatically filled for you.
@@ -64,23 +64,22 @@ selections. </em></li>
<h2>Step 2</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">Accessing and modifying data</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0; padding:.0em .5em .5em 1em;">For this
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>Accessing and modifying data</h2>
+ <p>For this
exercise, we are using a SQLite database to store our data. This is useful
if only <em>your</em> application will need to access or modify the data. If you wish for
other activities to access or modify the data, you have to expose the data using a
{@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}guide/topics/providers/content-providers.html">content providers</a> or the whole
+ <p>If you are interested, you can find out more about
+ <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>
+ </div>
<p>Take a look at the <code>NotesDbAdapter</code> class &mdash; this class is provided to
encapsulate data access to a SQLite database that will hold our notes data
@@ -137,25 +136,22 @@ selections. </em></li>
<h2 style="clear:right;">Step 3</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">Layouts and activities</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">Most Activity classes will have a layout associated with them. The layout
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>Layouts and activities</h2>
+ <p>Most Activity classes will have a layout associated with them. The layout
will be the "face" of the Activity to the user. In this case our layout will
take over the whole screen and provide a list of notes.</p>
- <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
+ <p>Full screen layouts are not the only option for an Activity however. You
might also want to use a <a
-href="{@docRoot}guide/appendix/faq/commontasks.html#floatingorfull">floating
+href="{@docRoot}resources/faq/commontasks.html#floatingorfull">floating
layout</a> (for example, a <a
-href="{@docRoot}guide/appendix/faq/commontasks.html#dialogsandalerts">dialog
+href="{@docRoot}resources/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>
- </div>
+ </div>
+ </div>
<p>Open the <code>notepad_list.xml</code> file in <code>res/layout</code>
and
@@ -233,23 +229,22 @@ and
<h2 style="clear:right;">Step 5</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- 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}guide/appendix/faq/commontasks.html#filelist">specific structure</a> to the
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>Resources and the R class</h2>
+ <p>The folders under res/ in the Eclipse project are for resources.
+ There is a <a href="{@docRoot}resources/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
+ <p>Resources defined in these folders and files will have
corresponding entries in the R class allowing them to be easily accessed
and used from your application. The R class is automatically generated using the contents
of the res/ folder by the eclipse plugin (or by aapt if you use the command line tools).
Furthermore, they will be bundled and deployed for you as part of the application.</p>
</p>
</div>
+ </div>
+
<p>To make the list of notes in the ListView, we also need to define a View for each row:</p>
<ol>
<li>
@@ -373,20 +368,18 @@ Notepadv1
<h2>Step 9</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- 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}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}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
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>More about menus</h2>
+ <p>The notepad application we are constructing only scratches the
+ surface with <a href="{@docRoot}resources/faq/commontasks.html#addmenuitems">menus</a>. </p>
+ <p>You can also <a href="{@docRoot}resources/faq/commontasks.html#menukeyshortcuts">add
+shortcut keys for menu items</a>, <a
+href="{@docRoot}resources/faq/commontasks.html#menukeyshortcuts">create
+submenus</a> and even <a href="{@docRoot}resources/faq/commontasks.html#addingtoothermenus">add
menu items to other applications!</a>. </p>
</div>
+ </div>
<p>Fill out the body of the <code>onCreateOptionsMenu()</code> method.</p>
@@ -486,19 +479,17 @@ We will simply
<h2>Step 12</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">List adapters</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">Our example uses a {@link android.widget.SimpleCursorAdapter
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>List adapters</h2>
+ <p>Our example uses a {@link android.widget.SimpleCursorAdapter
SimpleCursorAdapter} to bind a database {@link android.database.Cursor Cursor}
into a ListView, and this is a common way to use a {@link android.widget.ListAdapter
ListAdapter}. Other options exist like {@link android.widget.ArrayAdapter ArrayAdapter} which
can be used to take a List or Array of in-memory data and bind it in to
a list as well.</p>
</div>
+ </div>
<p>Define the <code>fillData()</code> method:</p>
<p>This
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex2.jd b/docs/html/guide/tutorials/notepad/notepad-ex2.jd
index 3b8fa0b..a945a62 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex2.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex2.jd
@@ -1,11 +1,11 @@
-page.title=Notepad Exercise 2
+Rpage.title=Notepad Exercise 2
parent.title=Notepad Tutorial
parent.link=index.html
@jd:body
<p><em>In this exercise, you will add a second Activity to your notepad application, to let the user
-create and edit notes. You will also allow the user to delete existing notes through a context menu.
+create and edit notes. You will also allow the user to delete existing notes through a context menu.
The new Activity assumes responsibility for creating new notes by
collecting user input and packing it into a return Bundle provided by the intent. This exercise
demonstrates:</em></p>
@@ -55,7 +55,7 @@ Tools</strong> &gt; <strong>Fix Project Properties</strong>.</p>
</li>
<li>
There are also a couple of new overridden methods
- (<code>onCreateContextMenu()</code>, <code>onContextItemSelected()</code>,
+ (<code>onCreateContextMenu()</code>, <code>onContextItemSelected()</code>,
<code>onListItemClick()</code> and <code>onActivityResult()</code>)
which we will be filling in below.
</li>
@@ -63,19 +63,20 @@ Tools</strong> &gt; <strong>Fix Project Properties</strong>.</p>
<h2>Step 2</h2>
-
+<div class="sidebox-wrapper">
<div class="sidebox">
<p>Context menus should always be used when performing actions upon specific elements in the UI.
When you register a View to a context menu, the context menu is revealed by performing a "long-click"
on the UI component (press and hold the touchscreen or highlight and hold down the selection key for about two seconds).</p>
</div>
+</div>
<p>First, let's create the context menu that will allow users to delete individual notes.
Open the Notepadv2 class.</p>
<ol>
<li>In order for each list item in the ListView to register for the context menu, we call
- <code>registerForContextMenu()</code> and pass it our ListView. So, at the very end of
+ <code>registerForContextMenu()</code> and pass it our ListView. So, at the very end of
the <code>onCreate()</code> method add this line:
<pre>registerForContextMenu(getListView());</pre>
<p>Because our Activity extends the ListActivity class, <code>getListView()</code> will return us
@@ -91,7 +92,7 @@ public boolean onCreateContextMenu(Menu menu, View v
super.onCreateContextMenu(menu, v, menuInfo);
menu.add(0, DELETE_ID, 0, R.string.menu_delete);
}</pre>
- <p>The <code>onCreateContextMenu()</code> callback some passes other information in addition to the Menu object,
+ <p>The <code>onCreateContextMenu()</code> callback passes some other information in addition to the Menu object,
such as the View that has been triggered for the menu and
an extra object that may contain additional information about the object selected. However, we don't care about
these here, because we only have one kind of object in the Activity that uses context menus. In the next
@@ -102,7 +103,7 @@ public boolean onCreateContextMenu(Menu menu, View v
<h2>Step 3</h2>
<p>Now that the we've registered our ListView for a context menu and defined our context menu item, we need
to handle the callback when it is selected. For this, we need to identify the list ID of the
- selected item, then delete it. So fill in the
+ selected item, then delete it. So fill in the
<code>onContextItemSelected()</code> method like this:</p>
<pre>
public boolean onContextItemSelected(MenuItem item) {
@@ -122,26 +123,23 @@ method of our NotesDbAdapter and the note is deleted. That's it for the context
can now be deleted.</p>
<h2 style="clear:right;">Step 4</h2>
-<div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">Starting Other Activities</h2>
- <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}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
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>Starting Other Activities</h2>
+ <p>In this example our Intent uses a class name specifically.
+ As well as
+ <a href="{@docRoot}resources/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>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">For example, we might want to open a page in a
+ <p>For example, we might want to open a page in a
browser, and for this we still use
an Intent. But instead of specifying a class to handle it, we use
a predefined Intent constant, and a content URI that describes what we
want to do. See {@link android.content.Intent
android.content.Intent} for more information.</p>
-</div>
+ </div>
+ </div>
<p>Fill in the body of the <code>createNote()</code> method:
<p>Create a new <code>Intent</code> to create a note
@@ -155,7 +153,7 @@ startActivityForResult(i, ACTIVITY_CREATE);</pre>
<code>NoteEdit</code>. Since the Intent class will need to communicate with the Android
operating system to route requests, we also have to provide a Context (<code>this</code>).</p>
<p>The <code>startActivityForResult()</code> method fires the Intent in a way that causes a method
- in our Activity to be called when the new Activity is completed. The method in our Activity
+ in our Activity to be called when the new Activity is completed. The method in our Activity
that receives the callback is called
<code>onActivityResult()</code> and we will implement it in a later step. The other way
to call an Activity is using <code>startActivity()</code> but this is a "fire-and-forget" way
@@ -164,7 +162,7 @@ startActivityForResult(i, ACTIVITY_CREATE);</pre>
<p>Don't worry about the fact that <code>NoteEdit</code> doesn't exist yet,
we will fix that soon. </p>
</li>
-
+
<h2>Step 5</h2>
@@ -180,7 +178,7 @@ startActivityForResult(i, ACTIVITY_CREATE);</pre>
interested in is the <code>position</code> that the user selected. We use
this to get the data from the correct row, and bundle it up to send to
the <code>NoteEdit</code> Activity.</p>
- <p>In our implementation of the callback, the method creates an
+ <p>In our implementation of the callback, the method creates an
<code>Intent</code> to edit the note using
the <code>NoteEdit</code> class. It then adds data into the extras Bundle of
the Intent, which will be passed to the called Activity. We use it
@@ -207,7 +205,7 @@ startActivityForResult(i, ACTIVITY_EDIT);</pre>
</li>
<li>
The details of the note are pulled out from our query Cursor, which we move to the
- proper position for the element that was selected in the list, with
+ proper position for the element that was selected in the list, with
the <code>moveToPosition()</code> method.</li>
<li>With the extras added to the Intent, we invoke the Intent on the
<code>NoteEdit</code> class by passing <code>startActivityForResult()</code>
@@ -219,7 +217,7 @@ startActivityForResult(i, ACTIVITY_EDIT);</pre>
variable is much more efficient than accessing a field in the Dalvik VM, so by doing this
we make only one access to the field, and five accesses to the local variable, making the
routine much more efficient. It is recommended that you use this optimization when possible.</p>
-
+
<h2>Step 6</h2>
@@ -243,7 +241,7 @@ startActivityForResult(i, ACTIVITY_EDIT);</pre>
<li><code>intent</code> &mdash; this is an Intent created by the Activity returning
results. It can be used to return data in the Intent "extras."
</li>
- </ul>
+ </ul>
<p>The combination of <code>startActivityForResult()</code> and
<code>onActivityResult()</code> can be thought of as an asynchronous RPC
(remote procedure call) and forms the recommended way for an Activity to invoke
@@ -277,7 +275,7 @@ case ACTIVITY_EDIT:
<code>ACTIVITY_EDIT</code> activity results in this method.
</li>
<li>
- In the case of a create, we pull the title and body from the extras (retrieved from the
+ In the case of a create, we pull the title and body from the extras (retrieved from the
returned Intent) and use them to create a new note.
</li>
<li>
@@ -288,29 +286,27 @@ case ACTIVITY_EDIT:
<code>fillData()</code> at the end ensures everything is up to date .
</li>
</ul>
-
+
<h2>Step 7</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">The Art of Layout</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0; padding:.0em .5em .5em 1em;">The provided
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>The Art of Layout</h2>
+ <p>The provided
note_edit.xml layout file is the most sophisticated one in the application we will be building,
but that doesn't mean it is even close to the kind of sophistication you will be likely to want
in real Android applications.</p>
- <p style="padding-left:.5em;font-size:12px;margin:0; padding:.0em .5em .5em 1em;">Creating a
+ <p>Creating a
good UI is part art and part science, and the rest is work. Mastery of <a
href="{@docRoot}guide/topics/ui/declaring-layout.html">Declaring 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}guide/tutorials/views/index.html">Hello Views</a>
+ <p>Take a look at the
+ <a href="{@docRoot}resources/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>
+ </div>
<p>Open the file <code>note_edit.xml</code> that has been provided and take a
look at it. This is the UI code for the Note Editor.</p>
@@ -335,7 +331,7 @@ case ACTIVITY_EDIT:
<code>layout_weight</code> specified, so it takes up the minimum space
required to render. If the <code>layout_weight</code> of each of the two
text edit elements is set to 1, the remaining width in the parent layout will
- be split equally between them (because we claim they are equally important).
+ be split equally between them (because we claim they are equally important).
If the first one has a <code>layout_weight</code> of 1
and the second has a <code>layout_weight</code> of 2, then one third of the
remaining space will be given to the first, and two thirds to the
@@ -373,7 +369,7 @@ case ACTIVITY_EDIT:
<code>onCreate(Bundle)</code> &mdash; and check the box next to it.</li>
<li>Click <strong>OK</strong>.<p>The method should now appear in your class.</p></li>
</ol>
-
+
<h2>Step 9</h2>
<p>Fill in the body of the <code>onCreate()</code> method for <code>NoteEdit</code>.</p>
@@ -388,7 +384,7 @@ case ACTIVITY_EDIT:
<p>We can then unbundle the values that were passed in to the Activity
with the extras Bundle attached to the calling Intent. We'll use them to pre-populate
the title and body text edit views so that the user can edit them.
- Then we will grab and store the <code>mRowId</code> so we can keep
+ Then we will grab and store the <code>mRowId</code> so we can keep
track of what note the user is editing.</p>
<ol>
@@ -406,14 +402,14 @@ case ACTIVITY_EDIT:
mTitleText = (EditText) findViewById(R.id.title);
mBodyText = (EditText) findViewById(R.id.body);
Button confirmButton = (Button) findViewById(R.id.confirm);</pre>
- <p>Note that <code>mTitleText</code> and <code>mBodyText</code> are member
+ <p>Note that <code>mTitleText</code> and <code>mBodyText</code> are member
fields (you need to declare them at the top of the class definition).</p>
</li>
<li>At the top of the class, declare a <code>Long mRowId</code> private field to store
the current <code>mRowId</code> being edited (if any).
</li>
- <li>Continuing inside <code>onCreate()</code>,
- add code to initialize the <code>title</code>, <code>body</code> and
+ <li>Continuing inside <code>onCreate()</code>,
+ add code to initialize the <code>title</code>, <code>body</code> and
<code>mRowId</code> from the extras Bundle in
the Intent (if it is present):<br>
<pre>
@@ -423,7 +419,7 @@ if (extras != null) {
String title = extras.getString(NotesDbAdapter.KEY_TITLE);
String body = extras.getString(NotesDbAdapter.KEY_BODY);
mRowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
-
+
if (title != null) {
mTitleText.setText(title);
}
@@ -459,16 +455,16 @@ if (extras != null) {
confirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
-
+
}
-
+
});</pre>
</li>
</ol>
<h2>Step 10</h2>
<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
text fields, and put them into the return Bundle so that they can be passed
@@ -483,7 +479,7 @@ confirmButton.setOnClickListener(new View.OnClickListener() {
constants defined in Notepadv2 as keys:<br>
<pre>
Bundle bundle = new Bundle();
-
+
bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
if (mRowId != null) {
@@ -498,7 +494,7 @@ mIntent.putExtras(bundle);
setResult(RESULT_OK, mIntent);
finish();</pre>
<ul>
- <li>The Intent is simply our data carrier that carries our Bundle
+ <li>The Intent is simply our data carrier that carries our Bundle
(with the title, body and mRowId).</li>
<li>The <code>setResult()</code> method is used to set the result
code and return Intent to be passed back to the
@@ -521,19 +517,19 @@ private Long mRowId;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.note_edit);
-
+
mTitleText = (EditText) findViewById(R.id.title);
mBodyText = (EditText) findViewById(R.id.body);
-
+
Button confirmButton = (Button) findViewById(R.id.confirm);
-
+
mRowId = null;
Bundle extras = getIntent().getExtras();
if (extras != null) {
String title = extras.getString(NotesDbAdapter.KEY_TITLE);
String body = extras.getString(NotesDbAdapter.KEY_BODY);
mRowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
-
+
if (title != null) {
mTitleText.setText(title);
}
@@ -541,12 +537,12 @@ protected void onCreate(Bundle savedInstanceState) {
mBodyText.setText(body);
}
}
-
+
confirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Bundle bundle = new Bundle();
-
+
bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
if (mRowId != null) {
@@ -562,24 +558,22 @@ protected void onCreate(Bundle savedInstanceState) {
}</pre>
</li>
</ol>
-
+
<h2>Step 11</h2>
-<div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;
- margin-bottom:.5em;margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">The All-Important Android Manifest File</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">The AndroidManifest.xml file is the way in which Android sees your
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>The All-Important Android Manifest File</h2>
+ <p>The AndroidManifest.xml file is the way in which Android sees your
application. This file defines the category of the application, where
it shows up (or even if it shows up) in the launcher or settings, what
activities, services, and content providers it defines, what intents it can
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}guide/topics/manifest/manifest-intro.html">The AndroidManifest.xml File</a></p>
- </div>
+ <p>For more information, see the reference document
+ <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">The AndroidManifest.xml
+File</a></p>
+ </div>
+ </div>
<p>Finally, the new Activity has to be defined in the manifest file:</p>
<p>Before the new Activity can be seen by Android, it needs its own
@@ -597,10 +591,10 @@ protected void onCreate(Bundle savedInstanceState) {
</li>
<li>Click the <strong>Application</strong> tab at the bottom of the Manifest editor.</li>
<li>Click <strong>Add...</strong> in the Application Nodes section.
- <p>If you see a dialog with radiobuttons at the top, select the top radio button:
+ <p>If you see a dialog with radiobuttons at the top, select the top radio button:
"Create a new element at the top level, in Application".</p></li>
<li>Make sure "(A) Activity" is selected in the selection pane of the dialog, and click <strong>OK</strong>.</li>
- <li>Click on the new "Activity" node, in the Application Nodes section, then
+ <li>Click on the new "Activity" node, in the Application Nodes section, then
type <code>.NoteEdit</code> into the <em>Name*</em>
field to the right. Press Return/Enter.</li>
</ol>
@@ -608,28 +602,28 @@ protected void onCreate(Bundle savedInstanceState) {
file, have a look around at some of the other options available (but be careful not to select
them otherwise they will be added to your Manifest). This editor should help you understand
and alter the AndroidManifest.xml file as you move on to more advanced Android applications.</p>
-
+
<p class="note">If you prefer to edit this file directly, simply open the
<code>AndroidManifest.xml</code> file and look at the source (use the
<code>AndroidManifest.xml</code> tab in the eclipse editor to see the source code directly).
Then edit the file as follows:<br>
- <code>&lt;activity android:name=".NoteEdit"&gt;&lt;/activity&gt;</code><br><br>
+ <code>&lt;activity android:name=".NoteEdit" /&gt;</code><br><br>
This should be placed just below the line that reads:<br>
<code>&lt;/activity&gt;</code> for the <code>.Notepadv2</code> activity.</p>
<h2 style="clear:right;">Step 12</h2>
<p>Now Run it!</p>
-<p>You should now be able to add real notes from
-the menu, as well as delete an existing one. Notice that in order to delete, you must
+<p>You should now be able to add real notes from
+the menu, as well as delete an existing one. Notice that in order to delete, you must
first use the directional controls on the device to highlight the note.
-Furthermore, selecting a note title from the list should bring up the note
-editor to let you edit it. Press confirm when finished to save the changes
+Furthermore, selecting a note title from the list should bring up the note
+editor to let you edit it. Press confirm when finished to save the changes
back to the database.
<h2>Solution and Next Steps</h2>
-<p>You can see the solution to this exercise in <code>Notepadv2Solution</code>
+<p>You can see the solution to this exercise in <code>Notepadv2Solution</code>
from the zip file to compare with your own.</p>
<p>Now try editing a note, and then hitting the back button on the emulator
instead of the confirm button (the back button is below the menu button). You
diff --git a/docs/html/guide/tutorials/notepad/notepad-ex3.jd b/docs/html/guide/tutorials/notepad/notepad-ex3.jd
index 8737280..573500f 100644
--- a/docs/html/guide/tutorials/notepad/notepad-ex3.jd
+++ b/docs/html/guide/tutorials/notepad/notepad-ex3.jd
@@ -36,7 +36,7 @@ notes.</p>
<ol>
<li>Remove the code in <code>NoteEdit</code> that parses the title and body
- from the extras Bundle.
+ from the extras Bundle.
<p>Instead, we are going to use the <code>DBHelper</code> class
to access the notes from the database directly. All we need passed into the
NoteEdit Activity is a <code>mRowId</code> (but only if we are editing, if creating we pass
@@ -57,7 +57,7 @@ if (body != null) {
}</pre>
</li>
</ol>
-
+
<h2>Step 2</h2>
<p>Create a class field for a <code>NotesDbAdapter</code> at the top of the NoteEdit class:</p>
@@ -67,11 +67,11 @@ if (body != null) {
<pre>
&nbsp;&nbsp;&nbsp; mDbHelper = new NotesDbAdapter(this);<br>
&nbsp;&nbsp;&nbsp; mDbHelper.open();</pre>
-
+
<h2>Step 3</h2>
<p>In <code>NoteEdit</code>, we need to check the <var>savedInstanceState</var> for the
-<code>mRowId</code>, in case the note
+<code>mRowId</code>, in case the note
editing contains a saved state in the Bundle, which we should recover (this would happen
if our Activity lost focus and then restarted).</p>
<ol>
@@ -87,11 +87,11 @@ if (body != null) {
</pre>
with this:
<pre>
- mRowId = savedInstanceState != null ? savedInstanceState.getLong(NotesDbAdapter.KEY_ROWID)
- : null;
+ mRowId = (savedInstanceState == null) ? null :
+ (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
if (mRowId == null) {
- Bundle extras = getIntent().getExtras();
- mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
+ Bundle extras = getIntent().getExtras();
+ mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
: null;
}
</pre>
@@ -100,10 +100,15 @@ if (body != null) {
Note the null check for <code>savedInstanceState</code>, and we still need to load up
<code>mRowId</code> from the <code>extras</code> Bundle if it is not
provided by the <code>savedInstanceState</code>. This is a ternary operator shorthand
- to safely either use the value or null if it is not present.
+ to safely either use the value or null if it is not present.
+ </li>
+ <li>
+ Note the use of <code>Bundle.getSerializable()</code> instead of
+ <code>Bundle.getLong()</code>. The latter encoding returns a <code>long</code> primitive and
+ so can not be used to represent the case when <code>mRowId</code> is <code>null</code>.
</li>
</ol>
-
+
<h2>Step 4</h2>
<p>Next, we need to populate the fields based on the <code>mRowId</code> if we
@@ -126,38 +131,38 @@ public void onClick(View view) {
}</pre>
<p>We will take care of storing the updates or new notes in the database
ourselves, using the life-cycle methods.</p>
-
+
<p>The whole <code>onCreate()</code> method should now look like this:</p>
<pre>
super.onCreate(savedInstanceState);
-
+
mDbHelper = new NotesDbAdapter(this);
mDbHelper.open();
-
+
setContentView(R.layout.note_edit);
-
+
mTitleText = (EditText) findViewById(R.id.title);
mBodyText = (EditText) findViewById(R.id.body);
-
+
Button confirmButton = (Button) findViewById(R.id.confirm);
-
-mRowId = savedInstanceState != null ? savedInstanceState.getLong(NotesDbAdapter.KEY_ROWID)
- : null;
+
+mRowId = (savedInstanceState == null) ? null :
+ (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
if (mRowId == null) {
Bundle extras = getIntent().getExtras();
- mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
+ mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
: null;
}
-
+
populateFields();
-
+
confirmButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setResult(RESULT_OK);
finish();
}
-
+
});</pre>
<h2>Step 6</h2>
@@ -180,38 +185,36 @@ is an Android convenience method provided to take care of the Cursor life-cycle.
and re-create resources as dictated by the Activity life-cycle, so we don't need to worry about
doing that ourselves. After that, we just look up the title and body values from the Cursor
and populate the View elements with them.</p>
-
+
<h2>Step 7</h2>
- <div class="sidebox" style="border:2px solid #FFFFDD;float:right;
- background-color:#FFFFEE;margin-right:0px;margin-bottom:.5em;
- margin-top:1em;padding:0em;width:240px;">
- <h2 style="border:0;font-size:12px;padding:.5em .5em .5em 1em;margin:0;
- background-color:#FFFFDD;">Why handling life-cycle events is important</h2>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">If you are used to always having control in your applications, you
- might not understand why all this life-cycle work is necessary. The reason
- is that in Android, you are not in control of your Activity, the
- operating system is!</p>
- <p style="padding-left:.5em;font-size:12px;margin:0;
- padding:.0em .5em .5em 1em;">As we have already seen, the Android model is based around activities
- calling each other. When one Activity calls another, the current Activity
- is paused at the very least, and may be killed altogether if the
- system starts to run low on resources. If this happens, your Activity will
- 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}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>
- </div>
-
-<p>Still in the <code>NoteEdit</code> class, we now override the methods
- <code>onSaveInstanceState()</code>, <code>onPause()</code> and
- <code>onResume()</code>. These are our life-cycle methods
+ <div class="sidebox-wrapper">
+ <div class="sidebox">
+ <h2>Why handling life-cycle events is important</h2>
+ <p>If you are used to always having control in your applications, you
+ might not understand why all this life-cycle work is necessary. The reason
+ is that in Android, you are not in control of your Activity, the
+ operating system is!</p>
+ <p>As we have already seen, the Android model is based around activities
+ calling each other. When one Activity calls another, the current Activity
+ is paused at the very least, and may be killed altogether if the
+ system starts to run low on resources. If this happens, your Activity will
+ have to store enough state to come back up later, preferably in the same
+ state it was in when it was killed.</p>
+ <p>
+ 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>
+ </div>
+ </div>
+
+<p>Still in the <code>NoteEdit</code> class, we now override the methods
+ <code>onSaveInstanceState()</code>, <code>onPause()</code> and
+ <code>onResume()</code>. These are our life-cycle methods
(along with <code>onCreate()</code> which we already have).</p>
<p><code>onSaveInstanceState()</code> is called by Android if the
@@ -241,8 +244,10 @@ and populate the View elements with them.</p>
&#64;Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
- outState.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
+ saveState();
+ outState.putSerializable(NotesDbAdapter.KEY_ROWID, mRowId);
}</pre>
+ <p>We'll define <code>saveState()</code> next.</p>
</li>
<li><code>
onPause()</code>:
@@ -252,7 +257,6 @@ and populate the View elements with them.</p>
super.onPause();
saveState();
}</pre>
- <p>We'll define <code>saveState()</code> next.</p>
</li>
<li><code>
onResume()</code>:
@@ -264,6 +268,10 @@ and populate the View elements with them.</p>
}</pre>
</li>
</ol>
+<p>Note that <code>saveState()</code> must be called in both <code>onSaveInstanceState()</code>
+and <code>onPause()</code> to ensure that the data is saved. This is because there is no
+guarantee that <code>onSaveInstanceState()</code> will be called and because when it <em>is</em>
+called, it is called before <code>onPause()</code>.</p>
<h2 style="clear:right;">Step 8</h2>
@@ -301,19 +309,18 @@ database.</p>
necessary. The resulting method should look like this:</p>
<pre>
&#64;Override
-protected void onActivityResult(int requestCode, int resultCode,
- Intent intent) {
+protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
fillData();
}</pre>
<p>Because the other class now does the work, all this has to do is refresh
the data.</p>
-
+
<h2>Step 10</h2>
<p>Also remove the lines which set the title and body from the
- <code>onListItemClick()</code> method (again they are no longer needed,
+ <code>onListItemClick()</code> method (again they are no longer needed,
only the <code>mRowId</code> is):</p>
<pre>
Cursor c = mNotesCursor;
@@ -344,13 +351,13 @@ so that all that should be left in that method is:
other occurrences of <code>mNotesCursor</code> in your <code>fillData()</code> method.
</ol>
<p>
-Run it! (use <em>Run As -&gt; Android Application</em> on the project right
+Run it! (use <em>Run As -&gt; Android Application</em> on the project right
click menu again)</p>
<h2>Solution and Next Steps</h2>
<p>You can see the solution to this exercise in <code>Notepadv3Solution</code>
-from
+from
the zip file to compare with your own.</p>
<p>
When you are ready, move on to the <a href="notepad-extra-credit.html">Tutorial
diff --git a/docs/html/intl/ja/guide/publishing/preparing.jd b/docs/html/intl/ja/guide/publishing/preparing.jd
index f1e7b45..e232f3b 100644
--- a/docs/html/intl/ja/guide/publishing/preparing.jd
+++ b/docs/html/intl/ja/guide/publishing/preparing.jd
@@ -113,9 +113,13 @@ href="{@docRoot}guide/publishing/publishing.html#market">Android マーケット
<h3 id="mapsApiKey">7. アプリケーションが MapView 要素を使用している場合は、Maps API キーに登録する</h3>
-<div class="sidebox" style="margin-bottom:.5em;padding:1em;"><p>
+<div class="sidebox-wrapper">
+<div class="sidebox"><p>
Maps API キーを取得する方法は、<a
-href="http://code.google.com/android/add-ons/google-apis/mapkey.html">Maps API キーの取得(英語のみ)</a> をご覧ください。</p></div>
+href="http://code.google.com/android/add-ons/google-apis/mapkey.html">Maps API キーの取得(英語のみ)</a>
+をご覧ください。</p>
+</div>
+</div>
<p>アプリケーションが Mapview 要素を使用する場合、アプリケーションを Google Maps サービスで登録し、Maps API キーを取得する必要があります。その後、MapView で Google Maps からデータを取得できるようになります。この処理を行うため、Maps サービスに署名証明書の MD5 フィンガープリントを提出します。 </p>
diff --git a/docs/html/intl/ja/guide/topics/fundamentals.jd b/docs/html/intl/ja/guide/topics/fundamentals.jd
index 247d076..d329a8c 100644
--- a/docs/html/intl/ja/guide/topics/fundamentals.jd
+++ b/docs/html/intl/ja/guide/topics/fundamentals.jd
@@ -613,7 +613,7 @@ onServiceDisconnected()}</code> メソッドが実装されているため、リ
</p>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<h2>スーパークラスの呼び出し</h2>
<p>
どのアクティビティ ライフサイクル メソッドの実装でも、必ず最初にスーパークラス バージョンを呼び出す必要があります。次に例を示します:
diff --git a/docs/html/intl/ja/guide/tutorials/hello-world.jd b/docs/html/intl/ja/guide/tutorials/hello-world.jd
index c12965c..647c828 100644
--- a/docs/html/intl/ja/guide/tutorials/hello-world.jd
+++ b/docs/html/intl/ja/guide/tutorials/hello-world.jd
@@ -25,7 +25,7 @@ page.title=Hello, World
<h2 id="avd">AVD の作成</h2>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>AVD の使用方法と使用可能なオプションについて詳しくは、<a href="{@docRoot}guide/developing/tools/avd.html">Android 仮想デバイス</a> のドキュメントを参照してください。</p>
</div>
</div>
@@ -155,7 +155,7 @@ public class HelloAndroid extends Activity {
</ol>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>Eclipse での起動構成の作成と編集について詳しくは、「<a href="{@docRoot}guide/developing/eclipse-adt.html#RunConfig">ADT を使用した Eclipse での開発</a>」を参照してください。</p>
</div>
</div>
@@ -232,11 +232,12 @@ public class HelloAndroid extends Activity {
<p>これらの XML レイアウト ファイルは、作成するプロジェクトの <code>res/layout/</code> ディレクトリ内に置かれます。「res」は「resources」の略で、アプリケーションに必要なコード以外のすべてのアセットがこのディレクトリに格納されます。リソースには、レイアウト ファイルの他に、画像、音声、ローカライズされた文字列などのアセットがあります。</p>
-
+<div class="sidebox-wrapper">
<div class="sidebox">
<h2>横表示レイアウト</h2>
<p>横表示の場合に異なるデザインで表示するには、レイアウト XML ファイルを /res/layout-land 内に入れます。Android 端末のレイアウトが横表示に変わると自動的にこのディレクトリが参照されます。このように横表示向けに定義されたレイアウトが存在しない場合、自動的にデフォルトのレイアウトが拡大して使用されます。</p>
</div>
+</div>
<p>Eclipse プラグインでは、このようなレイアウト ファイルの 1 つである「main.xml」が自動的に作成されます。先ほど「Hello World」アプリケーションを作成した際には、このファイルは無視してプログラマティックにレイアウトを作成しました。この作成方法は Android フレームワークについてより深く理解していただくことを意図したもので、実際にはほとんどの場合レイアウトはコードではなく XML ファイルで定義します。以下の手順では、既存のアプリケーションを変更して XML レイアウトが使用されるようにする方法を説明します。</p>
diff --git a/docs/html/intl/ja/resources/tutorials/hello-world.jd b/docs/html/intl/ja/resources/tutorials/hello-world.jd
index c12965c..0cda2fb 100644
--- a/docs/html/intl/ja/resources/tutorials/hello-world.jd
+++ b/docs/html/intl/ja/resources/tutorials/hello-world.jd
@@ -25,7 +25,7 @@ page.title=Hello, World
<h2 id="avd">AVD の作成</h2>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>AVD の使用方法と使用可能なオプションについて詳しくは、<a href="{@docRoot}guide/developing/tools/avd.html">Android 仮想デバイス</a> のドキュメントを参照してください。</p>
</div>
</div>
@@ -155,7 +155,7 @@ public class HelloAndroid extends Activity {
</ol>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>Eclipse での起動構成の作成と編集について詳しくは、「<a href="{@docRoot}guide/developing/eclipse-adt.html#RunConfig">ADT を使用した Eclipse での開発</a>」を参照してください。</p>
</div>
</div>
@@ -233,10 +233,12 @@ public class HelloAndroid extends Activity {
<p>これらの XML レイアウト ファイルは、作成するプロジェクトの <code>res/layout/</code> ディレクトリ内に置かれます。「res」は「resources」の略で、アプリケーションに必要なコード以外のすべてのアセットがこのディレクトリに格納されます。リソースには、レイアウト ファイルの他に、画像、音声、ローカライズされた文字列などのアセットがあります。</p>
+<div class="sidebox-wrapper">
<div class="sidebox">
<h2>横表示レイアウト</h2>
<p>横表示の場合に異なるデザインで表示するには、レイアウト XML ファイルを /res/layout-land 内に入れます。Android 端末のレイアウトが横表示に変わると自動的にこのディレクトリが参照されます。このように横表示向けに定義されたレイアウトが存在しない場合、自動的にデフォルトのレイアウトが拡大して使用されます。</p>
</div>
+</div>
<p>Eclipse プラグインでは、このようなレイアウト ファイルの 1 つである「main.xml」が自動的に作成されます。先ほど「Hello World」アプリケーションを作成した際には、このファイルは無視してプログラマティックにレイアウトを作成しました。この作成方法は Android フレームワークについてより深く理解していただくことを意図したもので、実際にはほとんどの場合レイアウトはコードではなく XML ファイルで定義します。以下の手順では、既存のアプリケーションを変更して XML レイアウトが使用されるようにする方法を説明します。</p>
diff --git a/docs/html/resources/tutorials/hello-world.jd b/docs/html/resources/tutorials/hello-world.jd
index 2b515a1..6e315b2 100644
--- a/docs/html/resources/tutorials/hello-world.jd
+++ b/docs/html/resources/tutorials/hello-world.jd
@@ -35,7 +35,7 @@ here when you've completed the installation.</p>
<h2 id="avd">Create an AVD</h2>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>To learn more about how to use AVDs and the options
available to you, refer to the
<a href="{@docRoot}guide/developing/tools/avd.html">Android
@@ -243,7 +243,7 @@ to see it running.</p>
</ol>
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+ <div class="sidebox">
<p>To learn more about creating and editing run configurations in Eclipse, refer to
<a href="{@docRoot}guide/developing/eclipse-adt.html#RunConfig">Developing In Eclipse,
with ADT</a>.</p>
diff --git a/docs/html/sdk/1.1_r1/upgrading.jd b/docs/html/sdk/1.1_r1/upgrading.jd
index 5628d04..bc71149 100644
--- a/docs/html/sdk/1.1_r1/upgrading.jd
+++ b/docs/html/sdk/1.1_r1/upgrading.jd
@@ -4,7 +4,7 @@ sdk.version=1.1_r1
<!--
<div class="sidebox-wrapper">
- <div class="sidebox-inner">
+<div class="sidebox">
<h2>Useful Links</h2>
diff --git a/docs/html/sdk/installing.jd b/docs/html/sdk/installing.jd
index 698c347..7b98e7f 100644
--- a/docs/html/sdk/installing.jd
+++ b/docs/html/sdk/installing.jd
@@ -130,7 +130,7 @@ debug your application.</p>
<h2 id="components">Add Android Platforms and Other Components</h2>
-<div class="sidebox-wrapper" style="margin-right:2.5em;">
+<div class="sidebox-wrapper">
<div class="sidebox">
<p>The <strong>Android SDK and AVD Manager</strong> tool is pre-installed in
your SDK. Using the tool is a key part of performing the initial setup of your
diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd
index e0c2431..d3dce9e 100644
--- a/docs/html/sdk/win-usb.jd
+++ b/docs/html/sdk/win-usb.jd
@@ -50,7 +50,7 @@ for the T-Mobile G1 and myTouch 3G (and similar devices).</p>
<h2 id="WinUsbDriver">Installing the USB Driver for Windows</h2>
<div class="sidebox-wrapper">
-<div class="sidebox-inner">
+<div class="sidebox">
<p>The USB driver for Windows provides support for the following
Android-powered
devices:</p>