summaryrefslogtreecommitdiffstats
path: root/docs/html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html')
-rw-r--r--docs/html/guide/topics/resources/string-resource.jd67
-rwxr-xr-xdocs/html/guide/topics/testing/testing_android.jd468
-rw-r--r--docs/html/resources/browser.jd49
-rw-r--r--docs/html/resources/index.jd96
-rw-r--r--docs/html/resources/resources-data.js632
-rw-r--r--docs/html/resources/resources_toc.cs288
-rw-r--r--docs/html/resources/samples/images/XmlPhotosAdapter.pngbin0 -> 108550 bytes
-rw-r--r--docs/html/resources/samples/images/XmlRssReader.pngbin0 -> 118780 bytes
-rw-r--r--docs/html/resources/topics.jd72
9 files changed, 1217 insertions, 455 deletions
diff --git a/docs/html/guide/topics/resources/string-resource.jd b/docs/html/guide/topics/resources/string-resource.jd
index 81c5d55..2db38f1 100644
--- a/docs/html/guide/topics/resources/string-resource.jd
+++ b/docs/html/guide/topics/resources/string-resource.jd
@@ -12,8 +12,8 @@ your application with strings:</p>
<dd>XML resource that provides a single string.</dd>
<dt><a href="#StringArray">String Array</a></dt>
<dd>XML resource that provides an array of strings.</dd>
- <dt><a href="#Plurals">Plurals</a></dt>
- <dd>XML resource that carries different strings for different pluralizations
+ <dt><a href="#Plurals">Quantity Strings (Plurals)</a></dt>
+ <dd>XML resource that carries different strings for different quantities
of the same word or phrase.</dd>
</dl>
@@ -218,13 +218,30 @@ getStringArray}(R.array.planets_array);
-<h2 id="Plurals">Plurals</h2>
+<h2 id="Plurals">Quantity Strings (Plurals)</h2>
-<p>A pair of strings that each provide a different plural form of the same word or phrase,
-which you can collectively reference from the application. When you request the plurals
-resource using a method such as {@link android.content.res.Resources#getQuantityString(int,int)
-getQuantityString()}, you must pass a "count", which will determine the plural form you
-require and return that string to you.</p>
+<p>Different languages have different rules for grammatical agreement with quantity. In English,
+for example, the quantity 1 is a special case. We write "1 book", but for any other quantity we'd
+write "<i>n</i> books". This distinction between singular and plural is very common, but other
+languages make finer distinctions. The full set supported by Android is <code>zero</code>,
+<code>one</code>, <code>two</code>, <code>few</code>, <code>many</code>, and <code>other</code>.
+
+<p>The rules for deciding which case to use for a given language and quantity can be very complex,
+so Android provides you with methods such as
+{@link android.content.res.Resources#getQuantityString(int,int) getQuantityString()} to select
+the appropriate resource for you.
+
+<p>Note that the selection is made based on grammatical necessity. A string for <code>zero</code>
+in English will be ignored even if the quantity is 0, because 0 isn't grammatically different
+from 2, or any other number except 1 ("zero books", "one book", "two books", et cetera).
+Don't be misled either by the fact that, say, <code>two</code> sounds like it could only apply to
+the quantity 2: a language may require that 2, 12, 102 (et cetera) are all treated like one
+another but differently to other quantities. Rely on your translator to know what distinctions
+their language actually insists upon.
+
+<p>It's often possible to avoid quantity strings by using quantity-neutral formulations such as
+"Books: 1". This will make your life and your translators' lives easier, if it's a style that's
+in keeping with your application.
<p class="note"><strong>Note:</strong> A plurals collection is a simple resource that is
referenced using the value provided in the {@code name} attribute (not the name of the XML
@@ -251,7 +268,7 @@ In Java: <code>R.plurals.<em>plural_name</em></code>
&lt;<a href="#plurals-element">plurals</a>
name="<em>plural_name</em>">
&lt;<a href="#plurals-item-element">item</a>
- quantity=["one" | "other"]
+ quantity=["zero" | "one" | "two" | "few" | "many" | "other"]
&gt;<em>text_string</em>&lt;/item>
&lt;/plurals>
&lt;/resources>
@@ -285,16 +302,27 @@ Styling</a>, below, for information about to properly style and format your stri
<p class="caps">attributes:</p>
<dl class="atn-list">
<dt><code>quantity</code></dt>
- <dd><em>Keyword</em>. A value indicating the case in which this string should be used. Valid
-values:
+ <dd><em>Keyword</em>. A value indicating when this string should be used. Valid
+values, with non-exhaustive examples in parentheses:
<table>
<tr><th>Value</th><th>Description</th></tr>
<tr>
- <td>{@code one}</td><td>When there is one (a singular string).</td>
+ <td>{@code zero}</td><td>When the language requires special treatment of the number 0 (as in Arabic).</td>
+ </tr>
+ <tr>
+ <td>{@code one}</td><td>When the language requires special treatment of numbers like one (as with the number 1 in English and most other languages; in Russian, any number ending in 1 but not ending in 11 is in this class).</td>
+ </tr>
+ <tr>
+ <td>{@code two}</td><td>When the language requires special treatment of numbers like two (as in Welsh).</td>
+ </tr>
+ <tr>
+ <td>{@code few}</td><td>When the language requires special treatment of "small" numbers (as with 2, 3, and 4 in Czech; or numbers ending 2, 3, or 4 but not 12, 13, or 14 in Polish).</td>
</tr>
<tr>
- <td>{@code other}</td><td>When the quantity is anything other than one (a plural
-string, but also used when the count is zero).</td>
+ <td>{@code many}</td><td>When the language requires special treatment of "large" numbers (as with numbers ending 11-99 in Maltese).</td>
+ </tr>
+ <tr>
+ <td>{@code other}</td><td>When the language does not require special treatment of the given quantity.</td>
</tr>
</table>
</dd>
@@ -315,6 +343,17 @@ string, but also used when the count is zero).</td>
&lt;/plurals>
&lt;/resources>
</pre>
+ <p>XML file saved at {@code res/values-pl/strings.xml}:</p>
+<pre>
+&lt;?xml version="1.0" encoding="utf-8"?>
+&lt;resources>
+ &lt;plurals name="numberOfSongsAvailable">
+ &lt;item quantity="one">Znaleziono jedn&#x0105; piosenk&#x0119;.&lt;/item>
+ &lt;item quantity="few">Znaleziono %d piosenki.&lt;/item>
+ &lt;item quantity="other">Znaleziono %d piosenek.&lt;/item>
+ &lt;/plurals>
+&lt;/resources>
+</pre>
<p>Java code:</p>
<pre>
int count = getNumberOfsongsAvailable();
diff --git a/docs/html/guide/topics/testing/testing_android.jd b/docs/html/guide/topics/testing/testing_android.jd
index 46ba769..9ace1cb 100755
--- a/docs/html/guide/topics/testing/testing_android.jd
+++ b/docs/html/guide/topics/testing/testing_android.jd
@@ -23,9 +23,9 @@ page.title=Testing and Instrumentation
<li>
<a href="#MockObjects">Mock object classes</a>
</li>
- <li>
- <a href="#InstrumentationTestRunner">Instrumentation Test Runner</a>
- </li>
+ <li>
+ <a href="#InstrumentationTestRunner">Instrumentation Test Runner</a>
+ </li>
</ol>
</li>
<li>
@@ -64,7 +64,8 @@ page.title=Testing and Instrumentation
<h2>Related Tutorials</h2>
<ol>
<li>
- <a href="{@docRoot}resources/tutorials/testing/helloandroid_test.html">Hello, Testing</a>
+ <a href="{@docRoot}resources/tutorials/testing/helloandroid_test.html">
+ Hello, Testing</a>
</li>
<li>
<a href="{@docRoot}resources/tutorials/testing/activity_test.html">Activity Testing</a>
@@ -73,10 +74,12 @@ page.title=Testing and Instrumentation
<h2>See Also</h2>
<ol>
<li>
- <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">Testing in Eclipse, with ADT</a>
+ <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">
+ Testing in Eclipse, with ADT</a>
</li>
<li>
- <a href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other IDEs</a>
+ <a href="{@docRoot}guide/developing/testing/testing_otheride.html">
+ Testing in Other IDEs</a>
</li>
</ol>
</div>
@@ -118,45 +121,55 @@ accomplishes this by running both the main application and the test application
in the same process. </p>
<p>Your test application is linked to the application under test by means of an
-<a
-href="{@docRoot}guide/topics/manifest/instrumentation-element.html"><code>&lt;instrumentation&gt;</code></a>
-element in the test application's manifest file. The attributes of the element
-specify the package name of the application under test and also tell Android how
-to run the test application. Instrumentation is described in more detail in the
-section <a href="#InstrumentationTestRunner">Instrumentation Test
-Runner</a>.</p>
+ <a
+ href="{@docRoot}guide/topics/manifest/instrumentation-element.html">
+ <code>&lt;instrumentation&gt;</code></a> element in the test application's manifest file.
+ The attributes of the element specify the package name of the application under test and also
+ tell Android how to run the test application. Instrumentation is described in more detail
+ in the section <a href="#InstrumentationTestRunner">Instrumentation Test Runner</a>.
+</p>
<p>The following diagram summarizes the Android testing environment:</p>
<img src="{@docRoot}images/testing/android_test_framework.png"/>
-<p>In Android, test applications are themselves Android applications, so you
-write them in much the same way as the application you are testing. The SDK
-tools help you create a main application project and its test project at the same
-time. You can run Android tests within Eclipse with ADT or from the command
-line. Eclipse with ADT provides an extensive set of tools for creating tests,
-running them, and viewing their results. You can also use the <code>adb</code>
-tool to run tests, or use a built-in Ant target.</p>
+<p>
+ In Android, test applications are themselves Android applications, so you
+ write them in much the same way as the application you are testing. The SDK
+ tools help you create a main application project and its test project at the same
+ time. You can run Android tests within Eclipse with ADT or from the command
+ line. Eclipse with ADT provides an extensive set of tools for creating tests,
+ running them, and viewing their results. You can also use the <code>adb</code>
+ tool to run tests, or use a built-in Ant target.
+</p>
-<p>To learn how to set up and run tests in Eclipse, please refer to <a
-href="{@docRoot}guide/developing/testing/testing_eclipse.html">Testing in
-Eclipse, with ADT</a>. If you're not working in Eclipse, refer to <a
-href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other
-IDEs</a>.</p>
+<p>
+ To learn how to set up and run tests in Eclipse, please refer to <a
+ href="{@docRoot}guide/developing/testing/testing_eclipse.html">Testing in
+ Eclipse, with ADT</a>. If you're not working in Eclipse, refer to <a
+ href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other
+ IDEs</a>.
+</p>
-<p>If you want a step-by-step introduction to Android testing, try one of the
-testing tutorials:</p>
+<p>
+ If you want a step-by-step introduction to Android testing, try one of the
+ testing tutorials:
+</p>
<ul>
- <li>The <a
-href="{@docRoot}resources/tutorials/testing/helloandroid_test.html">Hello,
-Testing</a> tutorial introduces basic testing concepts and procedures in the
-context of the Hello, World application.</li>
- <li>The <a
-href="{@docRoot}resources/tutorials/testing/activity_test.html">Activity
-Testing</a> tutorial is an excellent follow-up to the Hello, Testing tutorial.
-It guides you through a more complex testing scenario that you develop against a
-more realistic application.</li>
+ <li>
+ The <a
+ href="{@docRoot}resources/tutorials/testing/helloandroid_test.html">Hello,
+ Testing</a> tutorial introduces basic testing concepts and procedures in the
+ context of the Hello, World application.
+ </li>
+ <li>
+ The <a
+ href="{@docRoot}resources/tutorials/testing/activity_test.html">Activity
+ Testing</a> tutorial is an excellent follow-up to the Hello, Testing tutorial.
+ It guides you through a more complex testing scenario that you develop against a
+ more realistic application.
+ </li>
</ul>
<h2 id="TestAPI">The Testing API</h2>
@@ -166,120 +179,156 @@ more realistic application.</li>
a powerful instrumentation framework that lets your tests access the state and runtime objects
of the application under tests.
</p>
-<p>The sections below describe the major components of the testing API available in Android.</p>
+<p>
+ The sections below describe the major components of the testing API available in Android.
+</p>
<h3 id="Extensions">JUnit test case classes</h3>
<p>
- Some of the classes in the testing API extend the JUnit {@link junit.framework.TestCase TestCase} but do not use the instrumentation framework. These classes
- contain methods for accessing system objects such as the Context of the application under test. With this Context, you can look at its resources, files, databases,
- and so forth. The base class is {@link android.test.AndroidTestCase}, but you usually use a subclass associated with a particular component.
+ Some of the classes in the testing API extend the JUnit {@link junit.framework.TestCase TestCase}
+ but do not use the instrumentation framework. These classes contain methods for accessing system
+ objects such as the Context of the application under test. With this Context, you can look at its
+ resources, files, databases, and so forth. The base class is {@link android.test.AndroidTestCase},
+ but you usually use a subclass associated with a particular component.
<p>
The subclasses are:
</p>
<ul>
<li>
- {@link android.test.ApplicationTestCase} - A class for testing an entire application. It allows you to inject a mock Context into the application,
- set up initial test parameters before the application starts, and examine the application after it finishes but before it is destroyed.
+ {@link android.test.ApplicationTestCase} - A class for testing an entire application.
+ It allows you to inject a mock Context into the application, set up initial test parameters
+ before the application starts, and examine the application after it finishes but before it
+ is destroyed.
</li>
<li>
- {@link android.test.ProviderTestCase2} - A class for isolated testing of a single {@link android.content.ContentProvider}. Since it is restricted to using a
- {@link android.test.mock.MockContentResolver} for the provider, and it injects an {@link android.test.IsolatedContext}, your provider testing is isolated
+ {@link android.test.ProviderTestCase2} - A class for isolated testing of a single
+ {@link android.content.ContentProvider}. Since it is restricted to using a
+ {@link android.test.mock.MockContentResolver} for the provider, and it injects an
+ {@link android.test.IsolatedContext}, your provider testing is isolated
from the rest of the OS.
</li>
<li>
- {@link android.test.ServiceTestCase} - a class for isolated testing of a single {@link android.app.Service}. You can inject a mock Context or
- mock Application (or both), or let Android provide you a full Context and a {@link android.test.mock.MockApplication}.
+ {@link android.test.ServiceTestCase} - a class for isolated testing of a single
+ {@link android.app.Service}. You can inject a mock Context or mock Application (or both), or
+ let Android provide you a full Context and a {@link android.test.mock.MockApplication}.
</li>
</ul>
<h3 id="Instrumentation">Instrumentation test case classes</h3>
<p>
- The API for testing activities extends the JUnit {@link junit.framework.TestCase TestCase} class and also uses the instrumentation framework. With instrumentation,
- Android can automate UI testing by sending events to the application under test, precisely control the start of an activity, and monitor the state of the
- activity during its life cycle.
+ The API for testing activities extends the JUnit {@link junit.framework.TestCase TestCase} class
+ and also uses the instrumentation framework. With instrumentation, Android can automate UI
+ testing by sending events to the application under test, precisely control the start of an
+ activity, and monitor the state of the activity during its life cycle.
</p>
<p>
- The base class is {@link android.test.InstrumentationTestCase}. All of its subclasses have the ability to send a keystroke or touch event to the UI of the application
- under test. The subclasses can also inject a mock Intent.
- The subclasses are:
+ The base class is {@link android.test.InstrumentationTestCase}. All of its subclasses have
+ the ability to send a keystroke or touch event to the UI of the application
+ under test. The subclasses can also inject a mock Intent. The subclasses are:
</p>
<ul>
<li>
{@link android.test.ActivityTestCase} - A base class for activity test classes.
</li>
<li>
- {@link android.test.SingleLaunchActivityTestCase} - A convenience class for testing a single activity.
- It invokes {@link junit.framework.TestCase#setUp() setUp()} and {@link junit.framework.TestCase#tearDown() tearDown()} only
- once, instead of once per method call. Use it when all of your test methods run against the same activity.
+ {@link android.test.SingleLaunchActivityTestCase} - A convenience class for
+ testing a single activity. It invokes {@link junit.framework.TestCase#setUp() setUp()} and
+ {@link junit.framework.TestCase#tearDown() tearDown()} only once, instead of once per
+ method call. Use it when all of your test methods run against the same activity.
</li>
<li>
- {@link android.test.SyncBaseInstrumentation} - A class that tests synchronization of a content provider. It uses instrumentation to cancel and disable
- existing synchronizations before starting the test synchronization.
+ {@link android.test.SyncBaseInstrumentation} - A class that tests synchronization of a
+ content provider. It uses instrumentation to cancel and disable existing synchronizations
+ before starting the test synchronization.
</li>
<li>
- {@link android.test.ActivityUnitTestCase} - This class does an isolated test of a single activity. With it, you can inject a mock context or application, or both.
- It is intended for doing unit tests of an activity, and is the activity equivalent of the test classes described in <a href="#Extensions">JUnit test case classes</a>.
- <p> Unlike the other instrumentation classes, this test class cannot inject a mock Intent.</p>
+ {@link android.test.ActivityUnitTestCase} - This class does an isolated test of a single
+ activity. With it, you can inject a mock context or application, or both.
+ It is intended for doing unit tests of an activity, and is the activity equivalent of the
+ test classes described in <a href="#Extensions">JUnit test case classes</a>.
+ <p>
+ Unlike the other instrumentation classes, this test class cannot inject a mock Intent.
+ </p>
</li>
<li>
- {@link android.test.ActivityInstrumentationTestCase2} - This class tests a single activity within the normal system environment.
- You cannot inject a mock Context, but you can inject mock Intents. Also, you can run a test method on the UI thread (the main thread of the application under test),
- which allows you to send key and touch events to the application UI.
+ {@link android.test.ActivityInstrumentationTestCase2} - This class tests a single activity
+ within the normal system environment. You cannot inject a mock Context, but you can inject
+ mock Intents. Also, you can run a test method on the UI thread (the main thread of the
+ application under test), which allows you to send key and touch events to the
+ application UI.
</li>
</ul>
<h3 id="Assert">Assert classes</h3>
<p>
- Android also extends the JUnit {@link junit.framework.Assert} class that is the basis of <code>assert()</code> calls in tests.
- There are two extensions to this class, {@link android.test.MoreAsserts} and {@link android.test.ViewAsserts}:
+ Android also extends the JUnit {@link junit.framework.Assert} class that is the basis of
+ <code>assert()</code> calls in tests. There are two extensions to this class,
+ {@link android.test.MoreAsserts} and {@link android.test.ViewAsserts}:
</p>
<ul>
<li>
- The <code>MoreAsserts</code> class contains more powerful assertions such as {@link android.test.MoreAsserts#assertContainsRegex} that does regular expression matching.
+ The <code>MoreAsserts</code> class contains more powerful assertions such as
+ {@link android.test.MoreAsserts#assertContainsRegex} that does regular expression matching.
</li>
<li>
- The {@link android.test.ViewAsserts} class contains useful assertions about Android Views, such as {@link android.test.ViewAsserts#assertHasScreenCoordinates} that tests if a View has a particular X and Y
- position on the visible screen. These asserts simplify testing of geometry and alignment in the UI.
+ The {@link android.test.ViewAsserts} class contains useful assertions about Android Views,
+ such as {@link android.test.ViewAsserts#assertHasScreenCoordinates} that tests if a View has a
+ particular X and Y position on the visible screen. These asserts simplify testing of geometry
+ and alignment in the UI.
</li>
</ul>
<h3 id="MockObjects">Mock object classes</h3>
<p>
- Android has convenience classes for creating mock system objects such as applications, contexts, content resolvers, and resources. Android also provides
- methods in some test classes for creating mock Intents. Use these mocks to facilitate dependency injection, since they are easier to use than creating their
- real counterparts. These convenience classes are found in {@link android.test} and {@link android.test.mock}. They are:
+ Android has convenience classes for creating mock system objects such as applications, contexts,
+ content resolvers, and resources. Android also provides methods in some test classes for
+ creating mock Intents. Use these mocks to facilitate dependency injection, since they are
+ easier to use than creating their real counterparts. These convenience classes are found in
+ {@link android.test} and {@link android.test.mock}. They are:
</p>
<ul>
<li>
- {@link android.test.IsolatedContext} - Mocks a Context so that the application using it runs in isolation.
- At the same time, it has enough stub code to satisfy OS code that tries to communicate with contexts. This class is useful in unit testing.
+ {@link android.test.IsolatedContext} - Mocks a Context so that the application using it
+ runs in isolation. At the same time, it has enough stub code to satisfy OS code that tries
+ to communicate with contexts. This class is useful in unit testing.
</li>
<li>
- {@link android.test.RenamingDelegatingContext} - Delegates most context functions to an existing, normal context while changing the default file and database
- names in the context. Use this to test file and database operations with a normal system context, using test names.
+ {@link android.test.RenamingDelegatingContext} - Delegates most context functions to an
+ existing, normal context while changing the default file and database
+ names in the context. Use this to test file and database operations with a normal system
+ context, using test names.
</li>
<li>
- {@link android.test.mock.MockApplication}, {@link android.test.mock.MockContentResolver}, {@link android.test.mock.MockContext},
- {@link android.test.mock.MockDialogInterface}, {@link android.test.mock.MockPackageManager},
- {@link android.test.mock.MockResources} - Classes that create mock Android system objects for use in testing. They expose only those methods that are
- useful in managing the object. The default implementations of these methods simply throw an Exception. You are expected to extend the classes and
- override any methods that are called by the application under test.
+ {@link android.test.mock.MockApplication}, {@link android.test.mock.MockContentResolver},
+ {@link android.test.mock.MockContext}, {@link android.test.mock.MockDialogInterface},
+ {@link android.test.mock.MockPackageManager}, {@link android.test.mock.MockResources} -
+ Classes that create mock Android system objects for use in testing. They expose only those
+ methods that are useful in managing the object. The default implementations of these methods
+ simply throw an Exception. You are expected to extend the classes and override any methods '
+ that are called by the application under test.
</li>
</ul>
<h3 id="InstrumentationTestRunner">Instrumentation Test Runner</h3>
<p>
Android provides a custom class for running tests with instrumentation called called
{@link android.test.InstrumentationTestRunner}. This class
- controls of the application under test, runs the test application and the main application in the same process, and routes
- test output to the appropriate place. Using instrumentation is key to the ability of <code>InstrumentationTestRunner</code> to control the entire test
- environment at runtime. Notice that you use this test runner even if your test class does not itself use instrumentation.
+ controls of the application under test, runs the test application and the main application in the
+ same process, and routes test output to the appropriate place. Using instrumentation is key to the
+ ability of <code>InstrumentationTestRunner</code> to control the entire test
+ environment at runtime. Notice that you use this test runner even if your test class does not
+ itself use instrumentation.
</p>
<p>
- When you run a test application, you first run a system utility called Activity Manager. Activity Manager uses the instrumentation framework to start and control the test runner, which in turn uses instrumentation to shut down any running instances
- of the main application, starts the test application, and then starts the main application in the same process. This allows various aspects of the test application to work directly with the main application.
+ When you run a test application, you first run a system utility called Activity Manager. Activity
+ Manager uses the instrumentation framework to start and control the test runner, which in turn
+ uses instrumentation to shut down any running instances of the main application, starts the test
+ application, and then starts the main application in the same process. This allows various
+ aspects of the test application to work directly with the main application.
</p>
<p>
- If you are developing in Eclipse, the ADT plugin assists you in the setup of <code>InstrumentationTestRunner</code> or other test runners.
- The plugin UI prompts you to specify the test runner class to use, as well as the package name of the application under test.
- The plugin then adds an <code>&lt;instrumentation&gt;</code> element with appropriate attributes to the manifest file of the test application.
- Eclipse with ADT automatically starts a test application under the control of Activity Manager using instrumentation,
- and redirects the test output to the Eclipse window's JUnit view.
+ If you are developing in Eclipse, the ADT plugin assists you in the setup of
+ <code>InstrumentationTestRunner</code> or other test runners. The plugin UI prompts you to specify
+ the test runner class to use, as well as the package name of the application under test.
+ The plugin then adds an <code>&lt;instrumentation&gt;</code> element with appropriate attributes
+ to the manifest file of the test application. Eclipse with ADT automatically starts a test
+ application under the control of Activity Manager using instrumentation, and redirects the test
+ output to the Eclipse window's JUnit view.
</p>
<p>
If you prefer working from the command line, you can use Ant and the <code>android</code>
@@ -289,68 +338,105 @@ more realistic application.</li>
</p>
<h2 id="TestEnviroment">Working in the Test Environment</h2>
<p>
- The tests for an Android application are contained in a test application, which itself is an Android application. A test application resides in a separate Android project that has the
- same files and directories as a regular Android application. The test project is linked to the project of the application it tests
- (known as the application under test) by its manifest file.
+ The tests for an Android application are contained in a test application, which itself is an
+ Android application. A test application resides in a separate Android project that has the
+ same files and directories as a regular Android application. The test project is linked to the
+ project of the application it tests (known as the application under test) by its manifest file.
</p>
<p>
Each test application contains one or more test case classes based on an Android class for a
- particular type of component. The test case class contains methods that define tests on some part of the application under test. When you run the test application, Android
- starts it, loads the application under test into the same process, and then invokes each method in the test case class.
+ particular type of component. The test case class contains methods that define tests on some
+ part of the application under test. When you run the test application, Android
+ starts it, loads the application under test into the same process, and then invokes each method
+ in the test case class.
</p>
<p>
- The tools and procedures you use with testing depend on the development environment you are using. If you use Eclipse, then the ADT plug in for Eclipse provides tools that
- allow you to develop and run tests entirely within Eclipse. This is documented in the topic <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">Testing in Eclipse, with ADT</a>.
- If you use another development environment, then you use Android's command-line tools, as documented in the topic <a href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other IDEs</a>.
+ The tools and procedures you use with testing depend on the development environment you are
+ using. If you use Eclipse, then the ADT plug in for Eclipse provides tools that allow you to
+ develop and run tests entirely within Eclipse. This is documented in the topic
+ <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">
+ Testing in Eclipse, with ADT</a>. If you use another development environment, then you use
+ Android's command-line tools, as documented in the topic
+ <a href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other IDEs</a>.
</p>
<h3 id="TestProjects">Working with test projects</h3>
<p>
- To start testing an Android application, you create a test project for it using Android tools. The tools create the project directory and the files and subdirectories needed.
- The tools also create a manifest file that links the application in the test project to the application under test. The procedure for creating a test project in Eclipse with
- ADT is documented in <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">Testing in Eclipse, with ADT</a>. The procedure for creating a test project for use with development
- tools other than Eclipse is documented in <a href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other IDEs</a>.
+ To start testing an Android application, you create a test project for it using Android tools.
+ The tools create the project directory and the files and subdirectories needed.
+ The tools also create a manifest file that links the application in the test project to the
+ application under test. The procedure for creating a test project in Eclipse with ADT is
+ documented in <a href="{@docRoot}guide/developing/testing/testing_eclipse.html">
+ Testing in Eclipse, with ADT</a>. The procedure for creating a test project for use with
+ development tools other than Eclipse is documented in
+ <a href="{@docRoot}guide/developing/testing/testing_otheride.html">Testing in Other IDEs</a>.
</p>
<h3 id="TestClasses">Working with test case classes</h3>
<p>
- A test application contains one or more test case classes that extend an Android test case class. You choose a test case class based on the type of Android component you are testing and the
- tests you are doing. A test application can test different components, but each test case class is designed to test a single type of component.
- The Android test case classes are described in the section <a href="#TestAPI">The Testing API</a>.
+ A test application contains one or more test case classes that extend an Android test case
+ class. You choose a test case class based on the type of Android component you are testing and
+ the tests you are doing. A test application can test different components, but each test case
+ class is designed to test a single type of component. The Android test case classes are
+ described in the section <a href="#TestAPI">The Testing API</a>.
</p>
<p>
- Some Android components have more than one associated test case class. In this case, you choose among the available classes based on the type of tests you want to do. For activities,
- for example, you have the choice of either {@link android.test.ActivityInstrumentationTestCase2} or {@link android.test.ActivityUnitTestCase}.
+ Some Android components have more than one associated test case class. In this case, you choose
+ among the available classes based on the type of tests you want to do. For activities, for
+ example, you have the choice of either {@link android.test.ActivityInstrumentationTestCase2} or
+ {@link android.test.ActivityUnitTestCase}.
<p>
- <code>ActivityInstrumentationTestCase2</code> is designed to do functional testing, so it tests activities in a normal system infrastructure. You can inject mocked Intents, but not
+ <code>ActivityInstrumentationTestCase2</code> is designed to do functional testing, so it tests
+ activities in a normal system infrastructure. You can inject mocked Intents, but not
mocked Contexts. In general, you can't mock dependencies for the activity under test.
</p>
<p>
- In comparison, <code>ActivityUnitTestCase</code> is designed for unit testing, so it tests activities in an isolated system infrastructure. You can inject mocked or wrappered dependencies for
- the activity under test, particularly mocked Contexts. On the other hand, when you use this test case class the activity under test runs in isolation and can't interact with other activities.
+ In comparison, <code>ActivityUnitTestCase</code> is designed for unit testing, so it tests
+ activities in an isolated system infrastructure. You can inject mocked or wrappered
+ dependencies for the activity under test, particularly mocked Contexts. On the other hand,
+ when you use this test case class the activity under test runs in isolation and can't interact
+ with other activities.
</p>
<p>
- As a rule of thumb, if you wanted to test an activity's interaction with the rest of Android, you would use <code>ActivityInstrumentationTestCase2</code>. If you wanted to do regression testing
- on an activity, you would use <code>ActivityUnitTestCase</code>.
+ As a rule of thumb, if you wanted to test an activity's interaction with the rest of Android,
+ you would use <code>ActivityInstrumentationTestCase2</code>. If you wanted to do regression
+ testing on an activity, you would use <code>ActivityUnitTestCase</code>.
</p>
<h3 id="Tests">Working with test methods</h3>
<p>
- Each test case class provides methods that you use to set up the test environment and control the application under test. For example, all test case classes provide the JUnit {@link junit.framework.TestCase#setUp() setUp()}
- method that you can override to set up fixtures. In addition, you add methods to the class to define individual tests. Each method you add is run once each time you run the test application. If you override the <code>setUp()</code>
- method, it runs before each of your methods. Similarly, the JUnit {@link junit.framework.TestCase#tearDown() tearDown()} method is run once after each of your methods.
-</p>
-<p>
- The test case classes give you substantial control over starting and stopping components. For this reason, you have to specifically tell Android to start a component before you run tests against it. For example, you use the
- {@link android.test.ActivityInstrumentationTestCase2#getActivity()} method to start the activity under test. You can call this method once during the entire test case, or once for each test method. You can even destroy the
- activity under test by calling its {@link android.app.Activity#finish()} method and then restart it with <code>getActivity()</code> within a single test method.
+ Each test case class provides methods that you use to set up the test environment and control
+ the application under test. For example, all test case classes provide the JUnit
+ {@link junit.framework.TestCase#setUp() setUp()} method that you can override to set up
+ fixtures. In addition, you add methods to the class to define individual tests. Each method you
+ add is run once each time you run the test application. If you override the <code>setUp()</code>
+ method, it runs before each of your methods. Similarly, the JUnit
+ {@link junit.framework.TestCase#tearDown() tearDown()} method is run once after each of
+ your methods.
+</p>
+<p>
+ The test case classes give you substantial control over starting and stopping components. For
+ this reason, you have to specifically tell Android to start a component before you run tests
+ against it. For example, you use the
+ {@link android.test.ActivityInstrumentationTestCase2#getActivity()} method to start the activity
+ under test. You can call this method once during the entire test case, or once for each test
+ method. You can even destroy the activity under test by calling its
+ {@link android.app.Activity#finish()} method and then restart it with
+ <code>getActivity()</code> within a single test method.
</p>
<h3 id="RunTests">Running tests and seeing the results</h3>
<p>
- To run your tests, you build your test project and then run the test application using the system utility Activity Manager with instrumentation. You provide to Activity Manager the name of the test runner (usually
- {@link android.test.InstrumentationTestRunner}) you specified for your application; the name includes both your test application's package name and the test runner class name. Activity Manager loads and starts your
- test application, kills any instances of the application under test, loads an instance of the application under test into the same process as the test application, and then passes control to the first test case
- class in your test application. The test runner then takes control of the tests, running each of your test methods against the application under test until all the methods in all the classes have been run.
+ To run your tests, you build your test project and then run the test application using the
+ system utility Activity Manager with instrumentation. You provide to Activity Manager the name
+ of the test runner (usually {@link android.test.InstrumentationTestRunner}) you specified for
+ your application; the name includes both your test application's package name and the test
+ runner class name. Activity Manager loads and starts your test application, kills any instances
+ of the application under test, loads an instance of the application under test into the same
+ process as the test application, and then passes control to the first test case class in your
+ test application. The test runner then takes control of the tests, running each of your test
+ methods against the application under test until all the methods in all the classes have been
+ run.
</p>
<p>
- If you run a test within Eclipse with ADT, the output appears in a new JUnit view pane. If you run a test from the command line, the output goes to STDOUT.
+ If you run a test within Eclipse with ADT, the output appears in a new JUnit view pane. If you
+ run a test from the command line, the output goes to STDOUT.
</p>
<h2 id="TestAreas">What to Test</h2>
<p>
@@ -359,58 +445,64 @@ more realistic application.</li>
</p>
<ul>
<li>
- Activity lifecycle events: You should test that your activities handle lifecycle events correctly. For example
- an activity should respond to pause or destroy events by saving its state. Remember that even a change in screen orientation
- causes the current activity to be destroyed, so you should test that accidental device movements don't accidentally lose the
+ Activity lifecycle events: You should test that your activities handle lifecycle events
+ correctly. For example, an activity should respond to pause or destroy events by saving its
+ state. Remember that even a change in screen orientation causes the current activity to be
+ destroyed, so you should test that accidental device movements don't accidentally lose the
application state.
</li>
<li>
- Database operations: You should ensure that database operations correctly handle changes to the application's state.
- To do this, use mock objects from the package {@link android.test.mock android.test.mock}.
+ Database operations: You should ensure that database operations correctly handle changes to
+ the application's state. To do this, use mock objects from the package
+ {@link android.test.mock android.test.mock}.
</li>
<li>
- Screen sizes and resolutions: Before you publish your application, make sure to test it on all of the
- screen sizes and densities on which you want it to run. You can test the application on multiple sizes and densities using
- AVDs, or you can test your application directly on the devices that you are targeting. For more information, see
- the topic <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.
+ Screen sizes and resolutions: Before you publish your application, make sure to test it on
+ all of the screen sizes and densities on which you want it to run. You can test the
+ application on multiple sizes and densities using AVDs, or you can test your application
+ directly on the devices that you are targeting. For more information, see the topic
+ <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a>.
</li>
</ul>
<p>
- When possible, you should run these tests on an actual device. If this is not possible, you can
- use the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> with
- <a href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a> configured for
- the hardware, screens, and versions you want to test.
+ When possible, you should run these tests on an actual device. If this is not possible, you can
+ use the <a href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> with
+ <a href="{@docRoot}guide/developing/tools/avd.html">Android Virtual Devices</a> configured for
+ the hardware, screens, and versions you want to test.
</p>
<h2 id="UITesting">Appendix: UI Testing Notes</h2>
<p>
- The following sections have tips for testing the UI of your Android application, specifically
- to help you handle actions that run in the UI thread, touch screen and keyboard events, and home
- screen unlock during testing.
+ The following sections have tips for testing the UI of your Android application, specifically
+ to help you handle actions that run in the UI thread, touch screen and keyboard events, and home
+ screen unlock during testing.
</p>
<h3 id="RunOnUIThread">Testing on the UI thread</h3>
<p>
- An application's activities run on the application's <strong>UI thread</strong>. Once the
- UI is instantiated, for example in the activity's <code>onCreate()</code> method, then all
- interactions with the UI must run in the UI thread. When you run the application normally, it
- has access to the thread and does not have to do anything special.
+ An application's activities run on the application's <strong>UI thread</strong>. Once the
+ UI is instantiated, for example in the activity's <code>onCreate()</code> method, then all
+ interactions with the UI must run in the UI thread. When you run the application normally, it
+ has access to the thread and does not have to do anything special.
</p>
<p>
- This changes when you run tests against the application. With instrumentation-based classes,
- you can invoke methods against the UI of the application under test. The other test classes don't allow this.
- To run an entire test method on the UI thread, you can annotate the thread with <code>@UIThreadTest</code>.
- Notice that this will run <em>all</em> of the method statements on the UI thread. Methods that do not interact with the UI
- are not allowed; for example, you can't invoke <code>Instrumentation.waitForIdleSync()</code>.
+ This changes when you run tests against the application. With instrumentation-based classes,
+ you can invoke methods against the UI of the application under test. The other test classes
+ don't allow this. To run an entire test method on the UI thread, you can annotate the thread
+ with <code>@UIThreadTest</code>. Notice that this will run <em>all</em> of the method statements
+ on the UI thread. Methods that do not interact with the UI are not allowed; for example, you
+ can't invoke <code>Instrumentation.waitForIdleSync()</code>.
</p>
<p>
- To run a subset of a test method on the UI thread, create an anonymous class of type
- <code>Runnable</code>, put the statements you want in the <code>run()</code> method, and instantiate a new
- instance of the class as a parameter to the method <code><em>appActivity</em>.runOnUiThread()</code>, where
- <code><em>appActivity</em></code> is the instance of the app you are testing.
+ To run a subset of a test method on the UI thread, create an anonymous class of type
+ <code>Runnable</code>, put the statements you want in the <code>run()</code> method, and
+ instantiate a new instance of the class as a parameter to the method
+ <code><em>appActivity</em>.runOnUiThread()</code>, where <code><em>appActivity</em></code> is
+ the instance of the app you are testing.
</p>
<p>
- For example, this code instantiates an activity to test, requests focus (a UI action) for the Spinner displayed
- by the activity, and then sends a key to it. Notice that the calls to <code>waitForIdleSync</code> and <code>sendKeys</code>
- aren't allowed to run on the UI thread:</p>
+ For example, this code instantiates an activity to test, requests focus (a UI action) for the
+ Spinner displayed by the activity, and then sends a key to it. Notice that the calls to
+ <code>waitForIdleSync</code> and <code>sendKeys</code> aren't allowed to run on the UI thread:
+</p>
<pre>
private MyActivity mActivity; // MyActivity is the class name of the app under test
private Spinner mSpinner;
@@ -449,31 +541,36 @@ more realistic application.</li>
<h3 id="NotouchMode">Turning off touch mode</h3>
<p>
- To control the emulator or a device with key events you send from your tests, you must turn off
- touch mode. If you do not do this, the key events are ignored.
+ To control the emulator or a device with key events you send from your tests, you must turn off
+ touch mode. If you do not do this, the key events are ignored.
</p>
<p>
- To turn off touch mode, you invoke <code>ActivityInstrumentationTestCase2.setActivityTouchMode(false)</code>
- <em>before</em> you call <code>getActivity()</code> to start the activity. You must invoke the method in a test method
- that is <em>not</em> running on the UI thread. For this reason, you can't invoke the touch mode method
- from a test method that is annotated with <code>@UIThread</code>. Instead, invoke the touch mode method from <code>setUp()</code>.
+ To turn off touch mode, you invoke
+ <code>ActivityInstrumentationTestCase2.setActivityTouchMode(false)</code>
+ <em>before</em> you call <code>getActivity()</code> to start the activity. You must invoke the
+ method in a test method that is <em>not</em> running on the UI thread. For this reason, you
+ can't invoke the touch mode method from a test method that is annotated with
+ <code>@UIThread</code>. Instead, invoke the touch mode method from <code>setUp()</code>.
</p>
<h3 id="UnlockDevice">Unlocking the emulator or device</h3>
<p>
- You may find that UI tests don't work if the emulator's or device's home screen is disabled with the keyguard pattern.
- This is because the application under test can't receive key events sent by <code>sendKeys()</code>. The best
- way to avoid this is to start your emulator or device first and then disable the keyguard for the home screen.
+ You may find that UI tests don't work if the emulator's or device's home screen is disabled with
+ the keyguard pattern. This is because the application under test can't receive key events sent '
+ by <code>sendKeys()</code>. The best way to avoid this is to start your emulator or device
+ first and then disable the keyguard for the home screen.
</p>
<p>
- You can also explicitly disable the keyguard. To do this,
- you need to add a permission in the manifest file (<code>AndroidManifest.xml</code>) and
- then disable the keyguard in your application under test. Note, though, that you either have to remove this before
- you publish your application, or you have to disable it programmatically in the published app.
+ You can also explicitly disable the keyguard. To do this,
+ you need to add a permission in the manifest file (<code>AndroidManifest.xml</code>) and
+ then disable the keyguard in your application under test. Note, though, that you either have to
+ remove this before you publish your application, or you have to disable it programmatically in
+ the published app.
</p>
<p>
- To add the the permission, add the element <code>&lt;uses-permission android:name="android.permission.DISABLE_KEYGUARD"/&gt;</code>
- as a child of the <code>&lt;manifest&gt;</code> element. To disable the KeyGuard, add the following code
- to the <code>onCreate()</code> method of activities you intend to test:
+ To add the the permission, add the element
+ <code>&lt;uses-permission android:name="android.permission.DISABLE_KEYGUARD"/&gt;</code>
+ as a child of the <code>&lt;manifest&gt;</code> element. To disable the KeyGuard, add the
+ following code to the <code>onCreate()</code> method of activities you intend to test:
</p>
<pre>
mKeyGuardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
@@ -483,7 +580,8 @@ more realistic application.</li>
<p>where <code><em>activity_classname</em></code> is the class name of the activity.</p>
<h3 id="UITestTroubleshooting">Troubleshooting UI tests</h3>
<p>
- This section lists some of the common test failures you may encounter in UI testing, and their causes:
+ This section lists some of the common test failures you may encounter in UI testing, and their
+ causes:
</p>
<dl>
<dt><code>WrongThreadException</code></dt>
@@ -491,27 +589,33 @@ more realistic application.</li>
<p><strong>Problem:</strong></p>
For a failed test, the Failure Trace contains the following error message:
<code>
- android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
+ android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created
+ a view hierarchy can touch its views.
</code>
<p><strong>Probable Cause:</strong></p>
- This error is common if you tried to send UI events to the UI thread from outside the UI thread. This commonly happens if you send UI events
- from the test application, but you don't use the <code>@UIThread</code> annotation or the <code>runOnUiThread()</code> method. The test method tried to interact with the UI outside the UI thread.
+ This error is common if you tried to send UI events to the UI thread from outside the UI
+ thread. This commonly happens if you send UI events from the test application, but you don't
+ use the <code>@UIThread</code> annotation or the <code>runOnUiThread()</code> method. The
+ test method tried to interact with the UI outside the UI thread.
<p><strong>Suggested Resolution:</strong></p>
- Run the interaction on the UI thread. Use a test class that provides instrumentation. See the previous section <a href="#RunOnUIThread">Testing on the UI Thread</a>
+ Run the interaction on the UI thread. Use a test class that provides instrumentation. See
+ the previous section <a href="#RunOnUIThread">Testing on the UI Thread</a>
for more details.
</dd>
<dt><code>java.lang.RuntimeException</code></dt>
<dd>
<p><strong>Problem:</strong></p>
- For a failed test, the Failure Trace contains the following error message:
+ For a failed test, the Failure Trace contains the following error message:
<code>
java.lang.RuntimeException: This method can not be called from the main application thread
</code>
<p><strong>Probable Cause:</strong></p>
- This error is common if your test method is annotated with <code>@UiThreadTest</code> but then tries to
- do something outside the UI thread or tries to invoke <code>runOnUiThread()</code>.
+ This error is common if your test method is annotated with <code>@UiThreadTest</code> but
+ then tries to do something outside the UI thread or tries to invoke
+ <code>runOnUiThread()</code>.
<p><strong>Suggested Resolution:</strong></p>
- Remove the <code>@UiThreadTest</code> annotation, remove the <code>runOnUiThread()</code> call, or re-factor your tests.
+ Remove the <code>@UiThreadTest</code> annotation, remove the <code>runOnUiThread()</code>
+ call, or re-factor your tests.
</dd>
</dl>
diff --git a/docs/html/resources/browser.jd b/docs/html/resources/browser.jd
new file mode 100644
index 0000000..8a08769
--- /dev/null
+++ b/docs/html/resources/browser.jd
@@ -0,0 +1,49 @@
+page.title=Technical Resources
+@jd:body
+
+<style type="text/css">
+ {@literal @import} "{@docRoot}assets/android-developer-resource-browser.css";
+</style>
+
+<script type="text/javascript" src="{@docRoot}assets/android-developer-resource-browser.js"></script>
+<script type="text/javascript" src="{@docRoot}assets/microtemplate.js"></script>
+
+<div>
+ <p style="display: none; float: right">Filter: <input id="resource-browser-keyword-filter"/></p>
+ <p id="resource-browser-search-params">Showing all technical resources:</p>
+</div>
+
+<noscript>
+ <p class="note"><strong>Error:</strong>
+ You must have JavaScript enabled to view this page. Resources are also
+ available offline in the SDK.
+ </p>
+</noscript>
+
+<div id="resource-browser-results">
+ <div class="no-results">No results.</div>
+</div>
+
+<script type="text/html" id="tmpl_resource_browser_result">
+<div class="result">
+ <h3>
+ <% if ('external' in tagsHash) { %><strong>External: </strong> <% } %>
+ <a href="<%= path %>"><%= title.en %></a>
+ <% if ('new' in tagsHash) { %><span class="new">new!</span> <% } %>
+ </h3>
+ <p class="resource-meta"><%
+ var __g = ['', ''];
+ if ('article' in tagsHash) {
+ __g = ['Article', 'about'];
+ } else if ('tutorial' in tagsHash) {
+ __g = ['Tutorial', 'on'];
+ } else if ('sample' in tagsHash) {
+ __g = ['Sample', 'for'];
+ } else if ('video' in tagsHash) {
+ __g = ['Video', 'about'];
+ }
+ %>
+ <%= __g[0] %><% if (topicsHtml) { %> <%= __g[1] %><% } %> <%= topicsHtml %></p>
+ <p><%= description.en %></p>
+</div>
+</script>
diff --git a/docs/html/resources/index.jd b/docs/html/resources/index.jd
index 1668721..9055868 100644
--- a/docs/html/resources/index.jd
+++ b/docs/html/resources/index.jd
@@ -1,38 +1,90 @@
page.title=Developer Resources
@jd:body
+<style type="text/css">
+ #resource-list-table td {
+ border: 0;
+ padding: 0 24px;
+ width: 33%;
+ max-width: 250px;
+ border-right: 1px solid #ddd;
+ }
+
+ #resource-list-table td.last {
+ border-right: 0;
+ padding-right: 0;
+ }
+</style>
+
<p>
-This section provides technical articles, tutorials, sample code, and other
+This section provides articles, tutorials, sample code, and other
information to help you quickly implement the features you want in your
-application.
+application. To return to this page later, just click the "Resources"
+tab while any Resources page is loaded.
</p>
-<dl>
-<dt><b>Technical Articles</b></dt>
-<dd>Focused discussions about Android development subjects, including
-optimizations, tips, interesting implementations,
-and so on. Most of the articles provide "how-to" instructions for adding
-features or functionality to your app. The articles are drawn from posts to the
-Android Developers Blog.
-</dd>
-
-<dt><b>Tutorials</b></dt>
-<dd>Step-by-step instructions demonstrating how to build an Android application
-that has the specific features you want. </dd>
-
-<dt><b>Sample Code</b></dt>
-<dd>Fully-functioning sample applications that you can look at or build and run,
-to learn about how Android works. Feel free to reuse any of the code or
-techniques that you find in the samples!</dd>
+<h2>Technical Resources</h2>
+
+<table id="resource-list-table">
+<tr>
+ <td>
+ <a href="{@docRoot}resources/browser.html?tag=sample">
+ <img src="{@docRoot}assets/images/resource-big-sample.png"/>
+ </a>
+ <h3><a href="{@docRoot}resources/browser.html?tag=sample">
+ Sample Code
+ </a></h3>
+ <p>Fully-functioning sample applications that you can build and run
+ to learn about how Android works. Feel free to reuse any of the code or
+ techniques in the samples.</p>
+ </td>
+ <td>
+ <a href="{@docRoot}resources/browser.html?tag=article">
+ <img src="{@docRoot}assets/images/resource-big-article.png"/>
+ </a>
+ <h3><a href="{@docRoot}resources/browser.html?tag=article">
+ Articles
+ </a></h3>
+ <p>Focused discussions about Android development subjects, including
+ optimizations, tips, interesting implementations, "how-tos",
+ and so on.</p>
+ </td>
+ <td>
+ <a href="{@docRoot}resources/browser.html?tag=tutorial">
+ <img src="{@docRoot}assets/images/resource-big-tutorial.png"/>
+ </a>
+ <h3><a href="{@docRoot}resources/browser.html?tag=tutorial">
+ Tutorials
+ </a></h3>
+ <p>Step-by-step instructions demonstrating how to build an Android application
+ that has the specific features you want.</p>
+ </td>
+ <!-- <td class="last">
+ <a href="{@docRoot}resources/browser.html?tag=video">
+ <img src="{@docRoot}assets/images/resource-big-video.png"/>
+ </a>
+ <h3><a href="{@docRoot}resources/browser.html?tag=video">
+ Videos &amp; Screencasts
+ </a></h3>
+ <p>Videos and presentation slides from developer events, along with
+ screencasts to walk you through common Android development
+ workflows.</p>
+ </td> -->
+</tr>
+</table>
+<h2>Other Resources</h2>
+
+<dl>
<dt><b>Community</b></dt>
<dd>Links to the Android discussion groups and information about other ways to
collaborate with other developers. </dd>
+<dt><b>Device Dashboard</b></dt>
+<dd>Device distribution data, grouped by various dimensions such as screen size
+and Android platform version. </dd>
+
<dt><b>More</b></dt>
<dd>Quick development tips, troubleshooting information, and frequently asked
questions (FAQs). </dd>
</dl>
-
-<p>To return to this page later, just click the "Resources" tab while any
-Resources page is loaded. </p> \ No newline at end of file
diff --git a/docs/html/resources/resources-data.js b/docs/html/resources/resources-data.js
new file mode 100644
index 0000000..d06b695
--- /dev/null
+++ b/docs/html/resources/resources-data.js
@@ -0,0 +1,632 @@
+var ANDROID_TAGS = {
+ type: {
+ 'article': 'Article',
+ 'tutorial': 'Tutorial',
+ 'sample': 'Sample',
+ 'video': 'Video',
+ 'library': 'Code Library'
+ },
+ topic: {
+ 'accessibility': 'Accessibility',
+ 'accountsync': 'Accounts &amp; Sync',
+ 'bestpractice': 'Best Practices',
+ 'communication': 'Communication',
+ 'compatibility': 'Compatibility',
+ 'data': 'Data Access',
+ 'drawing': 'Canvas Drawing',
+ 'gamedev': 'Game Development',
+ 'gl': 'OpenGL ES',
+ 'input': 'Input Methods',
+ 'intent': 'Intents',
+ 'layout': 'Layouts/Views',
+ 'media': 'Multimedia',
+ 'newfeature': 'New Features',
+ 'performance': 'Performance',
+ 'search': 'Search',
+ 'testing': 'Testing',
+ 'ui': 'User Interface',
+ 'web': 'Web Content'
+ },
+ misc: {
+ 'external': 'External',
+ 'new': 'New'
+ }
+};
+
+var ANDROID_RESOURCES = [
+
+//////////////////////////
+/// TECHNICAL ARTICLES ///
+//////////////////////////
+
+ {
+ tags: ['article', 'performance', 'bestpractice'],
+ path: 'articles/avoiding-memory-leaks.html',
+ title: {
+ en: 'Avoiding Memory Leaks'
+ },
+ description: {
+ en: 'Mobile devices often have limited memory, and memory leaks can cause your application to waste this valuable resource without your knowledge. This article provides tips to help you avoid common causes of memory leaks on the Android platform.'
+ }
+ },
+ {
+ tags: ['article', 'compatibility'],
+ path: 'articles/backward-compatibility.html',
+ title: {
+ en: 'Backward Compatibility'
+ },
+ description: {
+ en: 'The Android platform strives to ensure backwards compatibility. However, sometimes you want to use new features which aren\'t supported on older platforms. This article discusses strategies for selectively using these features based on availability, allowing you to keep your applications portable across a wide range of devices.'
+ }
+ },
+ {
+ tags: ['article', 'intent'],
+ path: 'articles/can-i-use-this-intent.html',
+ title: {
+ en: 'Can I Use this Intent?'
+ },
+ description: {
+ en: 'Android offers a very powerful and yet easy-to-use message type called an intent. You can use intents to turn applications into high-level libraries and make code modular and reusable. While it is nice to be able to make use of a loosely coupled API, there is no guarantee that the intent you send will be received by another application. This article describes a technique you can use to find out whether the system contains any application capable of responding to the intent you want to use.'
+ }
+ },
+ {
+ tags: ['article', 'input'],
+ path: 'articles/creating-input-method.html',
+ title: {
+ en: 'Creating an Input Method'
+ },
+ description: {
+ en: 'Input Method Editors (IMEs) provide the mechanism for entering text into text fields and other Views. Android devices come bundled with at least one IME, but users can install additional IMEs. This article covers the basics of developing an IME for the Android platform.'
+ }
+ },
+ {
+ tags: ['article', 'drawing', 'ui'],
+ path: 'articles/drawable-mutations.html',
+ title: {
+ en: 'Drawable Mutations'
+ },
+ description: {
+ en: 'Drawables are pluggable drawing containers that allow applications to display graphics. This article explains some common pitfalls when trying to modify the properties of multiple Drawables.'
+ }
+ },
+ {
+ tags: ['article', 'bestpractice', 'ui'],
+ path: 'articles/faster-screen-orientation-change.html',
+ title: {
+ en: 'Faster Screen Orientation Change'
+ },
+ description: {
+ en: 'When an Android device changes its orientation, the default behavior is to automatically restart the current activity with a new configuration. However, this can become a bottleneck in applications that access a large amount of external data. This article discusses how to gracefully handle this situation without resorting to manually processing configuration changes.'
+ }
+ },
+ {
+ tags: ['article', 'compatibility'],
+ path: 'articles/future-proofing.html',
+ title: {
+ en: 'Future-Proofing Your Apps'
+ },
+ description: {
+ en: 'A collection of common sense advice to help you ensure that your applications don\'t break when new versions of the Android platform are released.'
+ }
+ },
+ {
+ tags: ['article', 'input'],
+ path: 'articles/gestures.html',
+ title: {
+ en: 'Gestures'
+ },
+ description: {
+ en: 'Touch screens allow users to perform gestures, such as tapping, dragging, flinging, or sliding, to perform various actions. The gestures API enables your application to recognize even complicated gestures with ease. This article explains how to integrate this API into an application.'
+ }
+ },
+ {
+ tags: ['article', 'gamedev', 'gl'],
+ path: 'articles/glsurfaceview.html',
+ title: {
+ en: 'Introducing GLSurfaceView'
+ },
+ description: {
+ en: 'This article provides an overview of GLSurfaceView, a class that makes it easy to implement 2D or 3D OpenGL rendering inside of an Android application.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'layout'],
+ path: 'articles/layout-tricks-reuse.html',
+ title: {
+ en: 'Layout Tricks: Creating Reusable UI Components'
+ },
+ description: {
+ en: 'Learn how to combine multiple standard UI widgets into a single high-level component, which can be reused throughout your application.'
+ }
+ },
+ {
+ tags: ['article', 'layout', 'ui', 'performance', 'bestpractice'],
+ path: 'articles/layout-tricks-efficiency.html',
+ title: {
+ en: 'Layout Tricks: Creating Efficient Layouts'
+ },
+ description: {
+ en: 'Learn how to optimize application layouts as this article walks you through converting a LinearLayout into a RelativeLayout, and analyzes the resulting implications on performance.'
+ }
+ },
+ {
+ tags: ['article', 'layout', 'ui', 'performance', 'bestpractice'],
+ path: 'articles/layout-tricks-stubs.html',
+ title: {
+ en: 'Layout Tricks: Using ViewStubs'
+ },
+ description: {
+ en: 'Learn about using ViewStubs inside an application\'s layout in order to inflate rarely used UI elements, without the performance implications which would otherwise be caused by using the <code>&lt;include&gt;</code> tag.'
+ }
+ },
+ {
+ tags: ['article', 'layout', 'ui', 'performance', 'bestpractice'],
+ path: 'articles/layout-tricks-merge.html',
+ title: {
+ en: 'Layout Tricks: Merging Layouts'
+ },
+ description: {
+ en: 'Learn how to use the <code>&lt;merge&gt;</code> tag in your XML layouts in order to avoid unnecessary levels of hierarchy within an application\'s view tree.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'performance'],
+ path: 'articles/listview-backgrounds.html',
+ title: {
+ en: 'ListView Backgrounds: An Optimization'
+ },
+ description: {
+ en: 'ListViews are very popular widgets within the Android framework. This article describes some of the optimizations used by the ListView widget, and how to avoid some common issues that this causes when trying to use a custom background.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'newfeature'],
+ path: 'articles/live-folders.html',
+ title: {
+ en: 'Live Folders'
+ },
+ description: {
+ en: 'Live Folders allow users to display any source of data on their home screen without launching an application. This article discusses how to export an application\'s data in a format suitable for display inside of a live folder.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'newfeature'],
+ path: 'articles/live-wallpapers.html',
+ title: {
+ en: 'Live Wallpapers'
+ },
+ description: {
+ en: 'Live wallpapers are richer, animated, interactive backgrounds that users can display in their home screens. Learn how to create a live wallpaper and bundle it in an application that users can install on their devices.'
+ }
+ },
+ {
+ tags: ['article', 'input'],
+ path: 'articles/on-screen-inputs.html',
+ title: {
+ en: 'Onscreen Input Methods'
+ },
+ description: {
+ en: 'The Input Method Framework (IMF) allows users to take advantage of on-screen input methods, such as software keyboards. This article provides an overview of Input Method Editors (IMEs) and how applications interact with them.'
+ }
+ },
+ {
+ tags: ['article', 'performance', 'bestpractice'],
+ path: 'articles/painless-threading.html',
+ title: {
+ en: 'Painless Threading'
+ },
+ description: {
+ en: 'This article discusses the threading model used by Android applications and how applications can ensure best UI performance by spawning worker threads to handle long-running operations, rather than handling them in the main thread. The article also explains the API that your application can use to interact with Android UI toolkit components running on the main thread and spawn managed worker threads.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'search'],
+ path: 'articles/qsb.html',
+ title: {
+ en: 'Quick Search Box'
+ },
+ description: {
+ en: 'Quick Search Box (QSB) is a powerful, system-wide search framework. QSB makes it possible for users to quickly and easily find what they\'re looking for, both on their devices and on the web. This article discusses how to work with the QSB framework to add new search results for an installed application.'
+ }
+ },
+ {
+ tags: ['article', 'ui'],
+ path: 'articles/touch-mode.html',
+ title: {
+ en: 'Touch Mode'
+ },
+ description: {
+ en: 'This article explains the touch mode, one of the most important principles of Android\'s UI toolkit. Whenever a user interacts with a device\'s touch screen, the system enters touch mode. While simple in concept, there are important implications touch mode that are often overlooked.'
+ }
+ },
+ {
+ tags: ['article', 'performance', 'bestpractice'],
+ path: 'articles/track-mem.html',
+ title: {
+ en: 'Tracking Memory Allocations'
+ },
+ description: {
+ en: 'This article discusses how to use the Allocation Tracker tool to observe memory allocations and avoid performance problems that would otherwise be caused by ignoring the effect of Dalvik\'s garbage collector.'
+ }
+ },
+ {
+ tags: ['article', 'newfeature'],
+ path: 'articles/ui-1.5.html',
+ title: {
+ en: 'UI Framework Changes in Android 1.5'
+ },
+ description: {
+ en: 'Explore the UI changes that were introduced in Android 1.5, compared with the UI provided in Android 1.0 and 1.1.'
+ }
+ },
+ {
+ tags: ['article', 'newfeature'],
+ path: 'articles/ui-1.6.html',
+ title: {
+ en: 'UI Framework Changes in Android 1.6'
+ },
+ description: {
+ en: 'Explore the UI changes that were introduced in Android 1.6, compared with the UI provided in Android 1.5. In particular, this article discusses changes to RelativeLayouts and click listeners.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'bestpractice'],
+ path: 'articles/timed-ui-updates.html',
+ title: {
+ en: 'Updating the UI from a Timer'
+ },
+ description: {
+ en: 'Learn about how to use Handlers as a more efficient replacement for java.util.Timer on the Android platform.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'accessibility'],
+ path: 'articles/tts.html',
+ title: {
+ en: 'Using Text-to-Speech'
+ },
+ description: {
+ en: 'The text-to-speech API lets your application "speak" to users, in any of several languages. This article provides an overview of the TTS API and how you use to add speech capabilities to your application.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'web'],
+ path: 'articles/using-webviews.html',
+ title: {
+ en: 'Using WebViews'
+ },
+ description: {
+ en: 'WebViews allow an application to dynamically display HTML and execute JavaScript, without relinquishing control to a separate browser application. This article introduces the WebView classes and provides a sample application that demonstrates its use.'
+ }
+ },
+ {
+ tags: ['article', 'ui'],
+ path: 'articles/wikinotes-linkify.html',
+ title: {
+ en: 'WikiNotes: Linkify your Text!'
+ },
+ description: {
+ en: 'This article introduces WikiNotes for Android, part of the Apps for Android project. It covers the use of Linkify to turn ordinary text views into richer, link-oriented content that causes Android intents to fire when a link is selected.'
+ }
+ },
+ {
+ tags: ['article', 'intent'],
+ path: 'articles/wikinotes-intents.html',
+ title: {
+ en: 'WikiNotes: Routing Intents'
+ },
+ description: {
+ en: 'This article illustrates how an application, in this case the WikiNotes sample app, can use intents to route various types of linked text to the application that handles that type of data. For example, an app can use intents to route a linked telephone number to a dialer app and a web URL to a browser.'
+ }
+ },
+ {
+ tags: ['article', 'ui', 'performance'],
+ path: 'articles/window-bg-speed.html',
+ title: {
+ en: 'Window Backgrounds & UI Speed'
+ },
+ description: {
+ en: 'Some Android applications need to squeeze every bit of performance out of the UI toolkit and there are many ways to do so. In this article, you will discover how to speed up the drawing and the perceived startup time of your activities. Both of these techniques rely on a single feature, the window\'s background drawable.'
+ }
+ },
+ {
+ tags: ['article', 'performance', 'bestpractice'],
+ path: 'articles/zipalign.html',
+ title: {
+ en: 'Zipalign: an Easy Optimization'
+ },
+ description: {
+ en: 'The Android SDK includes a tool called zipalign that optimizes the way an application is packaged. Running zipalign against your application enables Android to interact with it more efficiently at run time and thus has the potential to make it and the overall system run faster. This article provides a high-level overview of the zipalign tool and its use.'
+ }
+ },
+
+///////////////////
+/// SAMPLE CODE ///
+///////////////////
+
+ {
+ tags: ['sample', 'layout', 'ui'],
+ path: 'samples/ApiDemos/index.html',
+ title: {
+ en: 'API Demos'
+ },
+ description: {
+ en: 'A variety of small applications that demonstrate an extensive collection of framework topics.'
+ }
+ },
+ {
+ tags: ['sample', 'data', 'newfeature', 'accountsync', 'new'],
+ path: 'samples/BackupRestore/index.html',
+ title: {
+ en: 'Backup and Restore'
+ },
+ description: {
+ en: 'Illustrates a few different approaches that an application developer can take when integrating with the Android Backup Manager using the BackupAgent API introduced in Android 2.2.'
+ }
+ },
+ {
+ tags: ['sample', 'communication'],
+ path: 'samples/BluetoothChat/index.html',
+ title: {
+ en: 'Bluetooth Chat'
+ },
+ description: {
+ en: 'An application for two-way text messaging over Bluetooth.'
+ }
+ },
+ {
+ tags: ['sample', 'accountsync'],
+ path: 'samples/BusinessCard/index.html',
+ title: {
+ en: 'BusinessCard'
+ },
+ description: {
+ en: 'An application that demonstrates how to launch the built-in contact picker from within an activity. This sample also uses reflection to ensure that the correct version of the contacts API is used, depending on which API level the application is running under.'
+ }
+ },
+ {
+ tags: ['sample', 'accountsync'],
+ path: 'samples/ContactManager/index.html',
+ title: {
+ en: 'Contact Manager'
+ },
+ description: {
+ en: 'An application that demonstrates how to query the system contacts provider using the <code>ContactsContract</code> API, as well as insert contacts into a specific account.'
+ }
+ },
+ {
+ tags: ['sample'],
+ path: 'samples/Home/index.html',
+ title: {
+ en: 'Home'
+ },
+ description: {
+ en: 'A home screen replacement application.'
+ }
+ },
+ {
+ tags: ['sample', 'gamedev', 'media'],
+ path: 'samples/JetBoy/index.html',
+ title: {
+ en: 'JetBoy'
+ },
+ description: {
+ en: 'A game that demonstrates the SONiVOX JET interactive music technology, with <code><a href="/reference/android/media/JetPlayer.html">JetPlayer</a></code>.'
+ }
+ },
+ {
+ tags: ['sample', 'ui', 'newfeature'],
+ path: 'samples/CubeLiveWallpaper/index.html',
+ title: {
+ en: 'Live Wallpaper'
+ },
+ description: {
+ en: 'An application that demonstrates how to create a live wallpaper and bundle it in an application that users can install on their devices.'
+ }
+ },
+ {
+ tags: ['sample', 'gamedev', 'media'],
+ path: 'samples/LunarLander/index.html',
+ title: {
+ en: 'Lunar Lander'
+ },
+ description: {
+ en: 'A classic Lunar Lander game.'
+ }
+ },
+ {
+ tags: ['sample', 'ui', 'bestpractice', 'layout'],
+ path: 'samples/MultiResolution/index.html',
+ title: {
+ en: 'Multiple Resolutions'
+ },
+ description: {
+ en: 'A sample application that shows how to use resource directory qualifiers to provide different resources for different screen configurations.'
+ }
+ },
+ {
+ tags: ['sample', 'data'],
+ path: 'samples/NotePad/index.html',
+ title: {
+ en: 'Note Pad'
+ },
+ description: {
+ en: 'An application for saving notes. Similar (but not identical) to the <a href="/resources/tutorials/notepad/index.html">Notepad tutorial</a>.'
+ }
+ },
+ {
+ tags: ['sample', 'accountsync'],
+ path: 'samples/SampleSyncAdapter/index.html',
+ title: {
+ en: 'SampleSyncAdapter'
+ },
+ description: {
+ en: 'Demonstrates how an application can communicate with a cloud-based service and synchronize its data with data stored locally in a content provider. The sample uses two related parts of the Android framework &mdash; the account manager and the synchronization manager (through a sync adapter).'
+ }
+ },
+ {
+ tags: ['sample', 'ui', 'search', 'new'],
+ path: 'samples/SearchableDictionary/index.html',
+ title: {
+ en: 'Searchable Dictionary v2'
+ },
+ description: {
+ en: 'A sample application that demonstrates Android\'s search framework, including how to provide search suggestions for Quick Search Box.'
+ }
+ },
+ {
+ tags: ['sample', 'layout', 'ui'],
+ path: 'samples/Snake/index.html',
+ title: {
+ en: 'Snake'
+ },
+ description: {
+ en: 'An implementation of the classic game "Snake."'
+ }
+ },
+ {
+ tags: ['sample', 'testing', 'new'],
+ path: 'samples/Spinner/index.html',
+ title: {
+ en: 'Spinner'
+ },
+ description: {
+ en: 'A simple application that serves as an application under test for the SpinnerTest example.'
+ }
+ },
+ {
+ tags: ['sample', 'testing', 'new'],
+ path: 'samples/SpinnerTest/index.html',
+ title: {
+ en: 'SpinnerTest'
+ },
+ description: {
+ en: 'The test application for the Activity Testing tutorial. It tests the Spinner example application.'
+ }
+ },
+ {
+ tags: ['sample', 'newfeature', 'new'],
+ path: 'samples/TicTacToeLib/index.html',
+ title: {
+ en: 'TicTacToeLib'
+ },
+ description: {
+ en: 'An example of an Android library project, a type of project that lets you store and manage shared code and resources in one place, then make them available to your other Android applications.'
+ }
+ },
+ {
+ tags: ['sample', 'newfeature', 'new'],
+ path: 'samples/TicTacToeMain/index.html',
+ title: {
+ en: 'TicTacToeMain'
+ },
+ description: {
+ en: 'Demonstrates how an application can make use of shared code and resources stored in an Android library project.'
+ }
+ },
+ {
+ tags: ['sample', 'input'],
+ path: 'samples/SoftKeyboard/index.html',
+ title: {
+ en: 'Soft Keyboard'
+ },
+ description: {
+ en: 'An example of writing an input method for a software keyboard.'
+ }
+ },
+ {
+ tags: ['sample', 'ui'],
+ path: 'samples/Wiktionary/index.html',
+ title: {
+ en: 'Wiktionary'
+ },
+ description: {
+ en: 'An example of creating interactive widgets for display on the Android home screen.'
+ }
+ },
+ {
+ tags: ['sample', 'ui'],
+ path: 'samples/WiktionarySimple/index.html',
+ title: {
+ en: 'Wiktionary (Simplified)'
+ },
+ description: {
+ en: 'A simple Android home screen widgets example.'
+ }
+ },
+ {
+ tags: ['sample', 'layout', 'new'],
+ path: 'samples/XmlAdapters/index.html',
+ title: {
+ en: 'XML Adapters'
+ },
+ description: {
+ en: 'Binding data to views using XML Adapters examples.'
+ }
+ },
+
+/////////////////
+/// TUTORIALS ///
+/////////////////
+
+ {
+ tags: ['tutorial'],
+ path: 'tutorials/hello-world.html',
+ title: {
+ en: 'Hello World'
+ },
+ description: {
+ en: 'Beginning basic application development with the Android SDK.'
+ }
+ },
+ {
+ tags: ['tutorial', 'ui', 'layout'],
+ path: 'tutorials/views/index.html',
+ title: {
+ en: 'Hello Views'
+ },
+ description: {
+ en: 'A walk-through of the various types of layouts and views available in the Android SDK.'
+ }
+ },
+ {
+ tags: ['tutorial', 'ui', 'bestpractice'],
+ path: 'tutorials/localization/index.html',
+ title: {
+ en: 'Hello Localization'
+ },
+ description: {
+ en: 'The basics of localizing your applications for multiple languages and locales.'
+ }
+ },
+ {
+ tags: ['tutorial', 'data'],
+ path: 'tutorials/notepad/index.html',
+ title: {
+ en: 'Notepad Tutorial'
+ },
+ description: {
+ en: 'A multi-part tutorial discussing intermediate-level concepts such as data access.'
+ }
+ },
+ {
+ tags: ['tutorial', 'testing', 'new'],
+ path: 'tutorials/testing/helloandroid_test.html',
+ title: {
+ en: 'Hello Testing'
+ },
+ description: {
+ en: 'A basic introduction to the Android testing framework.'
+ }
+ },
+ {
+ tags: ['tutorial', 'testing', 'new'],
+ path: 'tutorials/testing/activity_test.html',
+ title: {
+ en: 'Activity Testing'
+ },
+ description: {
+ en: 'A more advanced demonstration of the Android testing framework and tools.'
+ }
+ }
+];
diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs
index 52689b6..a1711b5 100644
--- a/docs/html/resources/resources_toc.cs
+++ b/docs/html/resources/resources_toc.cs
@@ -1,5 +1,56 @@
<ul>
<li>
+ <h2><span class="en">Technical Resources</span>
+ </h2>
+ <ul>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>resources/browser.html?tag=sample">
+ <span class="en">Sample Code</span>
+ <span class="de" style="display:none">Beispielcode</span>
+ <span class="es" style="display:none">Código de ejemplo</span>
+ <span class="fr" style="display:none">Exemple de code</span>
+ <span class="it" style="display:none">Codice di esempio</span>
+ <span class="ja" style="display:none">サンプル コード</span>
+ <span class="zh-CN" style="display:none"></span>
+ <span class="zh-TW" style="display:none"></span>
+ </a></div>
+ <ul id="devdoc-nav-sample-list">
+ <li><a href="<?cs var:toroot ?>resources/samples/get.html">
+ <span class="en">Getting the Samples</span>
+ </a></li>
+ </ul>
+ </li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>resources/browser.html?tag=article">
+ <span class="en">Articles</span>
+ </a></div>
+ <ul id="devdoc-nav-article-list">
+ </ul>
+ </li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>resources/browser.html?tag=tutorial">
+ <span class="en">Tutorials</span>
+ <span class="de" style="display:none">Lernprogramme</span>
+ <span class="es" style="display:none">Tutoriales</span>
+ <span class="fr" style="display:none">Didacticiels</span>
+ <span class="it" style="display:none">Esercitazioni</span>
+ <span class="ja" style="display:none">チュートリアル</span>
+ <span class="zh-CN" style="display:none"></span>
+ <span class="zh-TW" style="display:none"></span>
+ </a></div>
+ <ul id="devdoc-nav-tutorial-list">
+ </ul>
+ </li>
+ <li class="toggle-list">
+ <div><a href="<?cs var:toroot ?>resources/topics.html">
+ <span class="en">Topics</span>
+ </a></div>
+ <ul id="devdoc-nav-topic-list">
+ </ul>
+ </li>
+ </ul>
+ </li>
+ <li>
<h2><span class="en">Community</span>
<span style="display:none" class="de"></span>
<span style="display:none" class="es">Comunidad</span>
@@ -34,241 +85,6 @@
</li><?cs
/if
?>
-
- <li>
- <h2><span class="en">Technical Articles</span>
- </h2>
- <ul>
- <li class="toggle-list">
- <div><a href="<?cs var:toroot ?>resources/articles/index.html">
- <span class="en">List of Articles</span>
- </a></div>
- <ul>
- <li><a href="<?cs var:toroot ?>resources/articles/avoiding-memory-leaks.html">
- <span class="en">Avoiding Memory Leaks</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/backward-compatibility.html">
- <span class="en">Backward Compatibility</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/can-i-use-this-intent.html">
- <span class="en">Can I Use this Intent?</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/creating-input-method.html">
- <span class="en">Creating an Input Method</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/drawable-mutations.html">
- <span class="en">Drawable Mutations</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/faster-screen-orientation-change.html">
- <span class="en">Faster Screen Orientation Change</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/future-proofing.html">
- <span class="en">Future-Proofing Your Apps</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/gestures.html">
- <span class="en">Gestures</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/glsurfaceview.html">
- <span class="en">Introducing GLSurfaceView</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/layout-tricks-reuse.html">
- <span class="en">Layout Tricks: Reusing </span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/layout-tricks-efficiency.html">
- <span class="en">Layout Tricks: Efficiency</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/layout-tricks-stubs.html">
- <span class="en">Layout Tricks: ViewStubs </span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/layout-tricks-merge.html">
- <span class="en">Layout Tricks: Merging </span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/listview-backgrounds.html">
- <span class="en">ListView Backgrounds</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/live-folders.html">
- <span class="en">Live Folders</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/live-wallpapers.html">
- <span class="en">Live Wallpapers</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/on-screen-inputs.html">
- <span class="en">Onscreen Input Methods</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/painless-threading.html">
- <span class="en">Painless Threading</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/qsb.html">
- <span class="en">Quick Search Box</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/speech-input.html">
- <span class="en">Speech Input</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/touch-mode.html">
- <span class="en">Touch Mode</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/track-mem.html">
- <span class="en">Tracking Memory Allocations</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/ui-1.5.html">
- <span class="en">UI Framework Changes in Android 1.5</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/ui-1.6.html">
- <span class="en">UI Framework Changes in Android 1.6</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/timed-ui-updates.html">
- <span class="en">Updating the UI from a Timer</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/tts.html">
- <span class="en">Using Text-to-Speech</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/contacts.html">
- <span class="en">Using the Contacts API</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/using-webviews.html">
- <span class="en">Using WebViews</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/wikinotes-linkify.html">
- <span class="en">WikiNotes: Linkify your Text!</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/wikinotes-intents.html">
- <span class="en">WikiNotes: Routing Intents</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/window-bg-speed.html">
- <span class="en">Window Backgrounds &amp; UI Speed</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/articles/zipalign.html">
- <span class="en">Zipalign: An Easy Optimization</span>
- </a></li>
- </ul>
- </li>
- </ul>
- </li>
-
- <li>
- <h2><span class="en">Tutorials</span>
- <span class="de" style="display:none">Lernprogramme</span>
- <span class="es" style="display:none">Tutoriales</span>
- <span class="fr" style="display:none">Didacticiels</span>
- <span class="it" style="display:none">Esercitazioni</span>
- <span class="ja" style="display:none">チュートリアル</span>
- <span class="zh-CN" style="display:none"></span>
- <span class="zh-TW" style="display:none"></span>
- </h2>
- <ul>
- <li><a href="<?cs var:toroot ?>resources/tutorials/hello-world.html">
- <span class="en">Hello World</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/tutorials/views/index.html">
- <span class="en">Hello Views</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/tutorials/localization/index.html">
- <span class="en">Hello Localization</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/tutorials/testing/helloandroid_test.html">
- <span class="en">Hello Testing</span></a>
- <span class="new">new!</span>
- </li>
- <li><a href="<?cs var:toroot ?>resources/tutorials/notepad/index.html">
- <span class="en">Notepad Tutorial</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/tutorials/testing/activity_test.html">
- <span class="en">Activity Testing</span></a>
- <span class="new">new!</span>
- </li>
- </ul>
- </li>
-
-
- <li>
- <h2><span class="en">Sample Code</span>
- <span class="de" style="display:none">Beispielcode</span>
- <span class="es" style="display:none">Código de ejemplo</span>
- <span class="fr" style="display:none">Exemple de code</span>
- <span class="it" style="display:none">Codice di esempio</span>
- <span class="ja" style="display:none">サンプル コード</span>
- <span class="zh-CN" style="display:none"></span>
- <span class="zh-TW" style="display:none"></span>
- </h2>
- <ul>
- <li><a href="<?cs var:toroot ?>resources/samples/get.html">
- <span class="en">Getting the Samples</span>
- </a></li>
- <li class="toggle-list">
- <div><a href="<?cs var:toroot ?>resources/samples/index.html">
- <span class="en">List of Samples</span>
- </a></div>
- <ul>
- <li><a href="<?cs var:toroot ?>resources/samples/ApiDemos/index.html">
- <span class="en">API Demos</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/BackupRestore/index.html">
- <span class="en">Backup and Restore</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/BluetoothChat/index.html">
- <span class="en">Bluetooth Chat</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/BusinessCard/index.html">
- <span class="en">Business Card</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/ContactManager/index.html">
- <span class="en">Contact Manager</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/Home/index.html">
- <span class="en">Home</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/JetBoy/index.html">
- <span class="en">JetBoy</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/CubeLiveWallpaper/index.html">
- <span class="en">Live Wallpaper</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/LunarLander/index.html">
- <span class="en">Lunar Lander</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/MultiResolution/index.html">
- <span class="en">Multiple Resolutions</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/NotePad/index.html">
- <span class="en">Note Pad</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/SampleSyncAdapter/index.html">
- <span class="en">Sample Sync Adapter</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/SearchableDictionary/index.html">
- <span class="en">Searchable Dictionary v2</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/Snake/index.html">
- <span class="en">Snake</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/SoftKeyboard/index.html">
- <span class="en">Soft Keyboard</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/Spinner/index.html">
- <span class="en">Spinner</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/SpinnerTest/index.html">
- <span class="en">SpinnerTest</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/TicTacToeLib/index.html">
- <span class="en">TicTacToeLib</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/TicTacToeMain/index.html">
- <span class="en">TicTacToeMain</span>
- </a> <span class="new">new!</span></li>
- <li><a href="<?cs var:toroot ?>resources/samples/Wiktionary/index.html">
- <span class="en">Wiktionary</span>
- </a></li>
- <li><a href="<?cs var:toroot ?>resources/samples/WiktionarySimple/index.html">
- <span class="en">Wiktionary (Simplified)</span>
- </a></li>
- </ul>
- </li>
- </ul>
- </li>
-
-
-
<li>
<h2><span class="en">More</span>
</h2>
@@ -297,8 +113,6 @@
</li>
</ul>
</li>
-
-
</ul>
<script type="text/javascript">
diff --git a/docs/html/resources/samples/images/XmlPhotosAdapter.png b/docs/html/resources/samples/images/XmlPhotosAdapter.png
new file mode 100644
index 0000000..c018d54
--- /dev/null
+++ b/docs/html/resources/samples/images/XmlPhotosAdapter.png
Binary files differ
diff --git a/docs/html/resources/samples/images/XmlRssReader.png b/docs/html/resources/samples/images/XmlRssReader.png
new file mode 100644
index 0000000..00f841b
--- /dev/null
+++ b/docs/html/resources/samples/images/XmlRssReader.png
Binary files differ
diff --git a/docs/html/resources/topics.jd b/docs/html/resources/topics.jd
new file mode 100644
index 0000000..b5960ff
--- /dev/null
+++ b/docs/html/resources/topics.jd
@@ -0,0 +1,72 @@
+page.title=Technical Resource Topics
+@jd:body
+
+<style type="text/css">
+ #resource-topic-table td {
+ border: 0;
+ padding: 0;
+ margin: 0;
+ padding-left: 1em;
+ width: 18em;
+ }
+
+ #resource-topic-table ul {
+ padding: 0;
+ margin: 0;
+ }
+
+ #resource-topic-table li {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ }
+</style>
+
+<p>
+You can browse the list of technical resources by topic by clicking on the
+links below. Over time, as more topics are added, they will be added to the
+list below.
+</p>
+
+<noscript>
+ <p class="note"><strong>Error:</strong>
+ You must have JavaScript enabled to view this page. Resources are also
+ available offline in the SDK.
+ </p>
+</noscript>
+
+<table id="resource-topic-table">
+ <tr></tr>
+</table>
+
+<script type="text/javascript">
+<!--
+(function() {
+ var topics = [];
+ for (var topic in ANDROID_TAGS['topic']) {
+ topics.push({name:topic,title:ANDROID_TAGS['topic'][topic]});
+ }
+ topics.sort(function(x,y){ return (x.title < y.title) ? -1 : 1; });
+ var topicParent = null;
+ for (var i = 0; i < topics.length; i++) {
+ if (topicParent == null || i % 10 == 0) {
+ // create a new column
+ topicParent = $('ul', $('<td><ul>').appendTo('#resource-topic-table tr'));
+ }
+
+ topicParent.append(
+ $('<li>').append(
+ $('<h3>').append(
+ $('<a>')
+ .attr('href', toRoot + "resources/browser.html?tag=" + topics[i].name)
+ .append($('<span>')
+ .addClass('en')
+ .html(topics[i].title)
+ )
+ )
+ )
+ );
+ }
+})();
+//-->
+</script> \ No newline at end of file