diff options
73 files changed, 2758 insertions, 711 deletions
diff --git a/Android.mk b/Android.mk index 83c4b5b1fe4e..b7ea2549e19d 100644 --- a/Android.mk +++ b/Android.mk @@ -443,6 +443,8 @@ web_docs_sample_code_flags := \ resources/samples/HoneycombGallery "Honeycomb Gallery" \ -samplecode $(sample_dir)/JetBoy \ resources/samples/JetBoy "JetBoy" \ + -samplecode $(sample_dir)/KeyChainDemo \ + resources/samples/KeyChainDemo "KeyChain Demo" \ -samplecode $(sample_dir)/LunarLander \ resources/samples/LunarLander "Lunar Lander" \ -samplecode $(sample_dir)/training/ads-and-ux \ diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index 211be52e0622..5d3670f53216 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -35,6 +35,14 @@ import com.android.internal.os.HandlerCaller; * etc. Such a service can optionally request the capability for querying the content * of the active window. Development of an accessibility service requires extending this * class and implementing its abstract methods. + * + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about creating AccessibilityServices, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> + * * <h3>Lifecycle</h3> * <p> * The lifecycle of an accessibility service is managed exclusively by the system and diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java index e5a5e986e704..edfefac2d81e 100644 --- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java +++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java @@ -41,6 +41,13 @@ import java.io.IOException; * {@link AccessibilityService} for {@link android.view.accessibility.AccessibilityEvent}s * according to the information encapsulated in this class. * + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about creating AccessibilityServices, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> + * * @see AccessibilityService * @see android.view.accessibility.AccessibilityEvent * @see android.view.accessibility.AccessibilityManager diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 54bb056ab035..6b4bbb3b15d2 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14804,6 +14804,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal * classes i.e. classes in package android.view, that would like their * applications to be backwards compatible. * </p> + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about making applications accessible, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> * <p> * A scenario in which a developer would like to use an accessibility delegate * is overriding a method introduced in a later API version then the minimal API diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java index 91dcac8db548..42403c17308b 100644 --- a/core/java/android/view/accessibility/AccessibilityEvent.java +++ b/core/java/android/view/accessibility/AccessibilityEvent.java @@ -59,6 +59,12 @@ import java.util.List; * by this class. For each event type there is a corresponding constant defined * in this class. Follows a specification of the event types and their associated properties: * </p> + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about creating and processing AccessibilityEvents, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> * <p> * <b>VIEW TYPES</b></br> * </p> diff --git a/core/java/android/view/accessibility/AccessibilityEventSource.java b/core/java/android/view/accessibility/AccessibilityEventSource.java index f11880bc8c07..525ba9e18461 100644 --- a/core/java/android/view/accessibility/AccessibilityEventSource.java +++ b/core/java/android/view/accessibility/AccessibilityEventSource.java @@ -18,6 +18,13 @@ package android.view.accessibility; /** * This interface is implemented by classes source of {@link AccessibilityEvent}s. + * + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about making applications accessible, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> */ public interface AccessibilityEventSource { diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 9b0f44a55614..eaaafec4673b 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -43,6 +43,12 @@ import java.util.List; * details about how to obtain a handle to window content as a tree of accessibility * node info as well as familiarizing with the security model. * </p> + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about making applications accessible, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> * * @see android.accessibilityservice.AccessibilityService * @see AccessibilityEvent diff --git a/core/java/android/view/accessibility/AccessibilityRecord.java b/core/java/android/view/accessibility/AccessibilityRecord.java index 18d0f6fe8a27..3b0202569117 100644 --- a/core/java/android/view/accessibility/AccessibilityRecord.java +++ b/core/java/android/view/accessibility/AccessibilityRecord.java @@ -41,6 +41,13 @@ import java.util.List; * event types. For detailed information please refer to {@link AccessibilityEvent}. * </p> * + * <div class="special reference"> + * <h3>Developer Guides</h3> + * <p>For more information about creating and processing AccessibilityRecords, read the + * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> + * developer guide.</p> + * </div> + * * @see AccessibilityEvent * @see AccessibilityManager * @see android.accessibilityservice.AccessibilityService diff --git a/core/java/android/view/accessibility/package.html b/core/java/android/view/accessibility/package.html index 4afafd3ca128..c2da0ae48654 100644 --- a/core/java/android/view/accessibility/package.html +++ b/core/java/android/view/accessibility/package.html @@ -35,5 +35,12 @@ changes etc. Parties interested in handling accessibility events implement and register an accessibility service which extends {@link android.accessibilityservice.AccessibilityService}. </p> +<div class="special reference"> +<h3>Developer Guides</h3> +<p>For more information about making applications accessible, read the +<a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> +developer guide.</p> +</div> + </body> </html> diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd index cc98f8fe8df7..bc7d83b6db1b 100644 --- a/docs/html/guide/appendix/api-levels.jd +++ b/docs/html/guide/appendix/api-levels.jd @@ -350,11 +350,11 @@ including the latest version, and provides an updater tool that you can use to download other platform versions as necessary. </p> <p>To access the updater, use the <code>android</code> command-line tool, -located in the <sdk>/tools directory. You can launch the Updater by using -the <code>android</code> command without specifying any options. You can +located in the <sdk>/tools directory. You can launch the SDK updater by +executing <code>android sdk</code>. You can also simply double-click the android.bat (Windows) or android (OS X/Linux) file. In ADT, you can also access the updater by selecting -<strong>Window</strong> > <strong>Android SDK and AVD +<strong>Window</strong> > <strong>Android SDK Manager</strong>.</p> <p>To run your application against different platform versions in the emulator, diff --git a/docs/html/guide/developing/building/building-cmdline.jd b/docs/html/guide/developing/building/building-cmdline.jd index c43962a81a28..fd90b1a5a7f1 100644 --- a/docs/html/guide/developing/building/building-cmdline.jd +++ b/docs/html/guide/developing/building/building-cmdline.jd @@ -202,12 +202,12 @@ ant release <ol> <li> - <strong>Open the SDK and AVD Manager and launch a virtual device</strong> + <strong>Open the AVD Manager and launch a virtual device</strong> - <p>From your SDK's <code>platform-tools/</code> directory, execute the {@code android} tool with no - arguments:</p> + <p>From your SDK's <code>platform-tools/</code> directory, execute the {@code android} tool +with the <code>avd</code> options:</p> <pre> -android +android avd </pre> <p>In the <em>Virtual Devices</em> view, select an AVD and click <strong>Start</strong>.</p> @@ -237,7 +237,7 @@ adb -s emulator-5554 install <em>path/to/your/app</em>.apk </ol> <p>If you don't see your application on the emulator, try closing the emulator and launching the - virtual device again from the SDK and AVD Manager. Sometimes when you install an application for the + virtual device again from the AVD Manager. Sometimes when you install an application for the first time, it won't show up in the application launcher or be accessible by other applications. This is because the package manager usually examines manifests completely only on emulator startup.</p> diff --git a/docs/html/guide/developing/devices/index.jd b/docs/html/guide/developing/devices/index.jd index a7d00f331bc9..64651a1ec907 100644 --- a/docs/html/guide/developing/devices/index.jd +++ b/docs/html/guide/developing/devices/index.jd @@ -7,9 +7,9 @@ page.title=Managing Virtual Devices <p>The easiest way to create an AVD is to use the graphical <a href= "{@docRoot}guide/developing/devices/managing-avds.html">AVD Manager</a>, which you launch - from Eclipse by clicking <strong>Window > Android SDK and AVD Manager</strong>. You can also start - the AVD Manager from the command line by calling the <code>android</code> tool in the <strong>tools</strong> - directory of the Android SDK.</p> + from Eclipse by clicking <strong>Window > AVD Manager</strong>. You can also start the AVD +Manager from the command line by calling the <code>android</code> tool with the <code>avd</code> +options, from the <strong><sdk>/tools/</strong> directory.</p> <p>You can also create AVDs on the command line by passing the <code>android</code> tool options. For more information on how to create AVDs in this manner, see <a href= diff --git a/docs/html/guide/developing/devices/managing-avds.jd b/docs/html/guide/developing/devices/managing-avds.jd index e70a0bbba0da..412bd913d613 100644 --- a/docs/html/guide/developing/devices/managing-avds.jd +++ b/docs/html/guide/developing/devices/managing-avds.jd @@ -42,8 +42,8 @@ parent.link=index.html <li>Start the AVD Manager: <ul> - <li>In Eclipse: select <strong>Window > Android SDK and AVD Manager</strong>, or click - the Android SDK and AVD Manager icon in the Eclipse toolbar.</li> + <li>In Eclipse: select <strong>Window > AVD Manager</strong>, or click + the AVD Manager icon in the Eclipse toolbar.</li> <li>In other IDEs: Navigate to your SDK's <code>tools/</code> directory and execute the <code>android</code> tool with no arguments.</li> @@ -72,7 +72,7 @@ parent.link=index.html <li>Click <strong>Create AVD</strong>.</li> </ol> - <p>Your AVD is now ready and you can either close the SDK and AVD Manager, create more AVDs, or + <p>Your AVD is now ready and you can either close the AVD Manager, create more AVDs, or launch an emulator with the AVD by selecting a device and clicking <strong>Start</strong>.</p> <h3 id="hardwareopts">Hardware options</h3> diff --git a/docs/html/guide/developing/projects/index.jd b/docs/html/guide/developing/projects/index.jd index 63e67cd8234e..b16e466e4a1f 100644 --- a/docs/html/guide/developing/projects/index.jd +++ b/docs/html/guide/developing/projects/index.jd @@ -209,8 +209,8 @@ used.</dd> application uses code and resources from an example library project called TicTacToeLib.</p> <p>To download the sample applications and run them as projects in - your environment, use the <em>Android SDK and AVD Manager</em> to download the "Samples for - SDK API 8" (or later) component into your SDK.</p> + your environment, use the <em>Android SDK Manager</em> to download the "Samples for + SDK API 8" (or later) package into your SDK.</p> <p>For more information and to browse the code of the samples, see the <a href="{@docRoot}resources/samples/TicTacToeMain/index.html">TicTacToeMain @@ -227,8 +227,8 @@ used.</dd> <p class="note"><strong>Note:</strong> You need SDK Tools r14 or newer to use the new library project feature that generates each library project into its own JAR file. You can download the tools and platforms using the - <em>Android SDK and AVD Manager</em>, as described in - <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p> + <em>Android SDK Manager</em>, as described in + <a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>.</p> <p>If you have source code and resources that are common to multiple Android projects, you can move them to a library project so that it is easier to maintain across applications and diff --git a/docs/html/guide/developing/tools/adt.jd b/docs/html/guide/developing/tools/adt.jd index e48a5ae5b230..d473e8589953 100644 --- a/docs/html/guide/developing/tools/adt.jd +++ b/docs/html/guide/developing/tools/adt.jd @@ -102,9 +102,8 @@ Project site.</p> (<strong>Window > Open Perspective > Traceview</strong>). </li> <li><a href="{@docRoot}guide/developing/tools/android.html">android</a>: Provides access to - the Android SDK and AVD Manager. Other <code>android</code> features such as creating or - updating projects (application and library) are integrated throughout the Eclipse IDE - (<strong>Window > Android SDK and AVD Manager</strong>). </li> + the Android SDK Manager and AVD Manager. Other <code>android</code> features such as creating or + updating projects (application and library) are integrated throughout the Eclipse IDE. </li> <li><a href="{@docRoot}guide/developing/debugging/debugging-ui.html#HierarchyViewer">Hierarchy Viewer</a>: Allows you to visualize your application's view hierarchy to find inefficiencies diff --git a/docs/html/guide/developing/tools/android.jd b/docs/html/guide/developing/tools/android.jd index a67012f11d36..295a720b36f3 100644 --- a/docs/html/guide/developing/tools/android.jd +++ b/docs/html/guide/developing/tools/android.jd @@ -15,9 +15,16 @@ Line</a>.</li> the Command Line</a>.</li> <li>Update your Android SDK with new platforms, add-ons, and documentation. See <a href= - "{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</li> + "{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>.</li> </ul>If you are using Eclipse, the <code>android</code> tool's features are integrated into ADT, so you should not need to use this tool directly. + + <p class="note"><strong>Note:</strong> The documentation of options below is not exhaustive +and may be out of date. For the most current list of options, execute <code>android +--help</code>.</p> + + + <h2>Syntax</h2> <pre>android [global options] action [action options]</pre> @@ -52,6 +59,26 @@ Line</a>.</li> </tr> <tr> + <td rowspan="6"><code>avd</code></td> + + <td>None</td> + + <td>Launch the AVD Manager</td> + + <td></td> + </tr> + + <tr> + <td rowspan="6"><code>sdk</code></td> + + <td>None</td> + + <td>Launch the Android SDK Manager</td> + + <td></td> + </tr> + + <tr> <td rowspan="6"><code>create avd</code></td> <td><code>-n <name></code></td> diff --git a/docs/html/guide/developing/tools/index.jd b/docs/html/guide/developing/tools/index.jd index 3d831f3e390c..5e9f68624146 100644 --- a/docs/html/guide/developing/tools/index.jd +++ b/docs/html/guide/developing/tools/index.jd @@ -12,8 +12,8 @@ latest Android platform.</p> <h2 id="tools-sdk">SDK Tools</h2> <p>The SDK tools are installed with the SDK starter package and are periodically updated. The SDK tools are required if you are developing Android applications. The most important SDK tools -include the Android SDK and AVD Manager (<code>android</code>), the emulator -(<code>emulator</code>), and the Dalvik Debug Monitor Server +include the Android SDK Manager (<code>android sdk</code>), the AVD Manager (<code>android +avd</code>) the emulator (<code>emulator</code>), and the Dalvik Debug Monitor Server (<code>ddms</code>). A short summary of some frequently-used SDK tools is provided below.</p> <dl> diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index 9d5064e4f863..ba8dc5e3fded 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -90,21 +90,20 @@ <ul> <li> <a href="<?cs var:toroot ?>guide/topics/providers/content-provider-basics.html"> - <span class="en">Content Provider Basics</span> + <span class="en">Content Provider Basics<span +class="new"> new!</span></span> </a> - <span class="new">new!</span> </li> <li> <a href="<?cs var:toroot ?>guide/topics/providers/content-provider-creating.html"> - <span class="en">Creating a Content Provider</span> + <span class="en">Creating a Content Provider<span +class="new"> new!</span></span> </a> - <span class="new">new!</span> </li> <li> <a href="<?cs var:toroot ?>guide/topics/providers/calendar-provider.html"> - <span class="en">Calendar Provider</span> + <span class="en">Calendar Provider<span class="new"> new!</span></span> </a> - <span class="new">new!</span> </li> </ul> </li> @@ -130,8 +129,8 @@ <span class="en">Input Events</span> </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/menus.html"> - <span class="en">Menus</span> - </a> <span class="new">updated</span></li> + <span class="en">Menus<span class="new"> new!</span></span> + </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <span class="en">Action Bar</span> </a></li> @@ -160,6 +159,19 @@ <li><a href="<?cs var:toroot ?>guide/topics/ui/custom-components.html"> <span class="en">Custom Components</span> </a></li> + <li class="toggle-list"> + <div><a href="<?cs var:toroot ?>guide/topics/ui/accessibility/index.html"> + <span class="en">Accessibility<span class="new"> new!</span></span> + </a></div> + <ul> + <li><a href="<?cs var:toroot ?>guide/topics/ui/accessibility/apps.html"> + <span class="en">Making Applications Accessible</span> + </a></li> + <li><a href="<?cs var:toroot ?>guide/topics/ui/accessibility/services.html"> + <span class="en">Building Accessibility Services</span> + </a></li> + </ul> + </li> <li><a href="<?cs var:toroot ?>guide/topics/ui/binding.html"> <span class="en">Binding to Data with AdapterView</span> </a></li> @@ -259,13 +271,13 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/graphics/index.html"> <span class="en">Graphics</span> - </a> <span class="new-child">new!</span></div> + </a></div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/graphics/2d-graphics.html"> <span class="en">Canvas and Drawables</span></a></li> <li><a href="<?cs var:toroot ?>guide/topics/graphics/hardware-accel.html"> <span class="en">Hardware Acceleration</span></a> - <span class="new">new!</span></li> + </li> <li><a href="<?cs var:toroot ?>guide/topics/graphics/opengl.html"> <span class="en">OpenGL</span> </a></li> @@ -287,7 +299,6 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/renderscript/index.html"> <span class="en">Renderscript</span></a> - <span class="new">updated</span> </div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/renderscript/graphics.html"> @@ -318,7 +329,6 @@ </li> <li><a href="<?cs var:toroot ?>guide/topics/media/camera.html"> <span class="en">Camera</span></a> - <span class="new">new!</span> </li> <li><a href="<?cs var:toroot ?>guide/topics/media/audio-capture.html"> <span class="en">Audio Capture</span></a> @@ -332,7 +342,7 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/topics/sensors/index.html"> <span class="en">Sensors</span> - </a> <span class="new">new!</span></div> + </a></div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/sensors/sensors_overview.html"> <span class="en">Sensors Overview</span> @@ -373,7 +383,7 @@ </li> <li class="toggle-list"> <div><a href="<?cs var:toroot?>guide/topics/nfc/index.html"> - <span class="en">Near Field Communication</span></a> <span class="new">updated</span> + <span class="en">Near Field Communication</span></a> </div> <ul> <li><a href="<?cs var:toroot ?>guide/topics/nfc/nfc.html">NFC Basics</a></li> @@ -381,7 +391,7 @@ </ul> </li> <li><a href="<?cs var:toroot?>guide/topics/wireless/wifip2p.html"> - <span class="en">Wi-Fi Direct</span></a> <span class="new">new!</span> + <span class="en">Wi-Fi Direct</span></a> </li> <li class="toggle-list"> <div><a href="<?cs var:toroot?>guide/topics/usb/index.html"> @@ -502,8 +512,7 @@ <span class="en">Multiple APK Support</span></a> </li> <li><a href="<?cs var:toroot ?>guide/market/expansion-files.html"> - <span class="en">APK Expansion Files</span></a> - <span class="new">new!</span> + <span class="en">APK Expansion Files<span class="new"> new!</span></span></a> </li> </ul> </li> @@ -788,7 +797,7 @@ applications</span> </li> <li><a href="<?cs var:toroot ?>guide/practices/tablets-and-handsets.html"> <span class="en">Supporting Tablets and Handsets</span> - </a> <span class="new">new!</span></li> + </a></li> <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/practices/ui_guidelines/index.html"> <span class="en">UI Guidelines</span> @@ -835,9 +844,6 @@ applications</span> </li> </ul> <ul> - <li><a href="<?cs var:toroot ?>guide/practices/design/accessibility.html"> - <span class="en">Designing for Accessibility</span> - </a></li> <li class="toggle-list"> <div><a href="<?cs var:toroot ?>guide/practices/design/performance.html"> <span class="en">Designing for Performance</span> diff --git a/docs/html/guide/market/billing/billing_integrate.jd b/docs/html/guide/market/billing/billing_integrate.jd index b49dc25d8993..4b3650fcc6d5 100755 --- a/docs/html/guide/market/billing/billing_integrate.jd +++ b/docs/html/guide/market/billing/billing_integrate.jd @@ -149,8 +149,8 @@ relies on these utility classes.</td> </table> <p>The in-app billing sample application is available as a downloadable component of the Android -SDK. To download the sample application component, launch the Android SDK and AVD Manager and then -select the "Google Market Billing package" component (see figure 1), and click <strong>Install +SDK. To download the sample application component, launch the Android SDK Manager and then +select the <strong>Google Market Billing package</strong> component (see figure 1), and click <strong>Install Selected</strong> to begin the download.</p> @@ -160,7 +160,7 @@ Selected</strong> to begin the download.</p> the AIDL file. </p> -<p>When the download is complete, the Android SDK and AVD Manager saves the component into the +<p>When the download is complete, the Android SDK Manager saves the component into the following directory:</p> <p><code><sdk>/extras/google/market_billing/</code></p> diff --git a/docs/html/guide/market/licensing/overview.jd b/docs/html/guide/market/licensing/overview.jd index 05a3a409fa78..e7e23f877dad 100644 --- a/docs/html/guide/market/licensing/overview.jd +++ b/docs/html/guide/market/licensing/overview.jd @@ -58,8 +58,9 @@ information about the application and user—your application and the Google together to assemble the information and the Google Play client passes it to the server. </p> <p>To help you add licensing to your application, the Android SDK provides a downloadable set of -library sources that you can include in your application project: the "Google Market Licensing -package." The License Verification Library (LVL) is a library you can add to your application that +library sources that you can include in your application project: the Google Market +Licensing package. The License Verification Library (LVL) is a library you can add to your +application that handles all of the licensing-related communication with the Google Play licensing service. With the LVL added to your application, your application can determine its licensing status for the current user by simply calling a method and implementing a callback that receives the status @@ -116,7 +117,7 @@ tampered with or that are spoofed.</p> <h2 id="LVL">Licensing Verification Library</h2> -<p>The Android SDK provides a downloadable component called the "Google Market Licensing package," +<p>The Android SDK provides a downloadable package called the Google Market Licensing package, which includes the License Verification Library (LVL). The LVL greatly simplifies the process of adding licensing to your application and helps ensure a more secure, robust implementation for your application. The LVL provides internal classes that handle most of the standard operations of a @@ -162,8 +163,8 @@ does not cache any response data and allows the application access <em>only</em> when the server returns a licensed response.</dd> </dl> -<p>The LVL is available as a downloadable component of the Android SDK. The -component includes both the LVL itself and an example application that shows how +<p>The LVL is available as a downloadable package of the Android SDK. The +package includes both the LVL itself and an example application that shows how the library should be integrated with your application and how your application should manage response data, UI interaction, and error conditions. </p> diff --git a/docs/html/guide/market/licensing/setting-up.jd b/docs/html/guide/market/licensing/setting-up.jd index 41e3bc49b7b5..0de7819b0108 100644 --- a/docs/html/guide/market/licensing/setting-up.jd +++ b/docs/html/guide/market/licensing/setting-up.jd @@ -173,25 +173,25 @@ your application without having publish it. For more information see <a href="#acct-signin">Signing in to an authorized account</a>, below.</p></li> </ul> -<p>Several versions of the add-on are available through the SDK Manager, but only -<strong>Google APIs Add-On, API 8 (release 2) or higher</strong> includes the necessary Google +<p>Several versions of the Google APIs add-on are available through the SDK Manager, but only +the version for Android 2.2 and higher includes the necessary Google Play services.</p> <p>To set up an emulator for adding licensing to an application, follow these steps: </p> <ol> - <li>Launch the Android SDK Manager. </li> - <li>In the <strong>Available Packages</strong> panel, select and download the -SDK component "Google APIs (Google Inc.) - API Level 8" (or higher) from the SDK -repository. - <p>When the download is complete, use the Android SDK Manager to -create a new AVD based on that component, described next.</p></li> - <li>In the <strong>Virtual -Devices</strong> panel of the Android SDK Manager, click + <li>Launch the Android SDK Manager (available under the Eclipse <strong>Window</strong> +menu or by executing {@code <sdk>/tools/android sdk}).</li> + <li>Select and download <strong>Google APIs</strong> for the Android version you'd like to target +(must be Android 2.2 or higher).</li> + <li>When the download is complete, open the AVD Manager (available under the Eclipse +<strong>Window</strong> +menu or by executing {@code <sdk>/tools/android avd}).</li> + <li>Click <strong>New</strong> and set the configuration details for the new AVD. </li> <li>In the dialog that appears, assign a descriptive name to the AVD and then -use the "Target" menu to choose the "Google APIs (Google Inc.) - API Level 8" as +use the Target menu to choose the <strong>Google APIs</strong> as the system image to run on the new AVD. Set the other configuration details as needed and then click <strong>Create AVD</strong> to finish. The SDK tools create the new AVD configuration, which then appears in the list of available @@ -238,8 +238,8 @@ greatly simplify the work that you need to do to add licensing to your application. In all cases, we recommend that you download the LVL and use it as the basis for the licensing implementation in your application.</p> -<p>The LVL is available as a downloadable component of the Android SDK. The -component includes: </p> +<p>The LVL is available as a downloadable package of the Android SDK. The +package includes: </p> <ul> <li>The LVL sources, stored inside an Android library project. </li> @@ -248,9 +248,9 @@ project. The example illustrates how an application uses the library helper classes to check and enforce licensing.</li> </ul> -<p>To download the LVL component into your development environment, use the +<p>To download the LVL package into your development environment, use the Android SDK Manager. Launch the Android SDK Manager and then -select the "Google Market Licensing" component, as shown in figure 2. +select the <strong>Google Market Licensing</strong> package, as shown in figure 2. Accept the terms and click <strong>Install Selected</strong> to begin the download. </p> <img src="{@docRoot}images/licensing_package.png" alt=""/> @@ -265,8 +265,8 @@ the LVL library project and the example application into these directories: </p> <code><<em>sdk</em>>/extras/google/market_licensing/sample/</code> (the example application)</p> -<p>If you aren't familiar with how to download components into your SDK, see the -<a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> +<p>If you aren't familiar with how to download packess into your SDK, see the +<a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a> document. </p> @@ -676,7 +676,7 @@ credentials. </p> <ol> <li>Open Settings > Accounts & sync</li> -<li>Select <strong>Add Account</strong> and choose to add a "Google" account. +<li>Select <strong>Add Account</strong> and choose to add a Google account. </li> <li>Select <strong>Next</strong> and then <strong>Sign in</strong>.</li> <li>Enter the username and password of either the publisher account or a test diff --git a/docs/html/guide/practices/design/accessibility.html b/docs/html/guide/practices/design/accessibility.html new file mode 100644 index 000000000000..0fa7b3213dd9 --- /dev/null +++ b/docs/html/guide/practices/design/accessibility.html @@ -0,0 +1,11 @@ +<html> +<head> +<meta http-equiv="refresh" +content="0;url=http://developer.android.com/guide/topics/ui/accessibility/index.html"> +<title>Redirecting...</title> +</head> +<body> +<p>You should be redirected. Please <a +href="http://developer.android.com/guide/topics/ui/accessibility/index.html">click here</a>.</p> +</body> +</html>
\ No newline at end of file diff --git a/docs/html/guide/practices/design/accessibility.jd b/docs/html/guide/practices/design/accessibility.jd deleted file mode 100644 index 72da04ecc271..000000000000 --- a/docs/html/guide/practices/design/accessibility.jd +++ /dev/null @@ -1,352 +0,0 @@ -page.title=Designing for Accessibility -@jd:body - - -<div id="qv-wrapper"> -<div id="qv"> - - <h2>Quickview</h2> - <ul> - <li>To make your application more accessible, you should make sure your UI is navigable -using a directional controller and your widgets provide content descriptions</li> - <li>If you implement a custom view, you should ensure that it delivers the appropriate -accessibility events during user interaction</li> - </ul> - - <h2>In this document</h2> - <ol> - <li><a href="#Navigation">Allow Navigation with a Directional Controller</a> - <ol> - <li><a href="#FocusOrder">Controlling focus order</a></li> - <li><a href="#ClickingDpad">Clicking with a directional controller</a></li> - </ol> - </li> - <li><a href="#LabelInputs">Label Your Input Widgets</a></li> - <li><a href="#UiBestPractices">Follow Android UI Best Practices</a></li> - <li><a href="#CustomViews">Send Accessibility Events from Custom View Components</a></li> - <li><a href="#Test">Test Your Application’s Accessibility</a></li> - </ol> - - <h2>Key classes</h2> - <ol> - <li>{@link android.view.accessibility.AccessibilityEvent}</li> - <li>{@link android.view.accessibility.AccessibilityEventSource}</li> - </ol> - - <h2>Related samples</h2> - <ol> - <li><a -href="{@docRoot}resources/samples/AccessibilityService/index.html">Accessibility Service</a></li> - </ol> - -</div> -</div> - - - -<p>Many Android users have disabilities that require them to interact with their Android devices in -different ways. These include users who have visual, physical or age-related disabilities that -prevent them from fully using or seeing a touchscreen.</p> - -<p>Android provides an accessibility layer that helps these users navigate their Android-powered -devices more easily. Android's accessibility services provide things like text-to-speech, haptic -feedback, and trackball/d-pad navigation that augment the user experience.</p> - -<p>Your application should follow the guidelines in this document to ensure that it provides a -good experience for users with disabilities. Following these two basic rules will solve most -access-related problems:</p> - -<ul> -<li>Make all of your user interface controls accessible with a trackball or directional -controller (d-pad).</li> -<li>Label your {@link android.widget.ImageButton}, {@link android.widget.EditText}, and other input -widgets using the <a -href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription">{@code -android:contentDescription}</a> attribute.</li> -</ul> - - - -<h2 id="Navigation">Allow Navigation with a Directional Controller</h2> - -<p>Many Android devices come with some sort of directional controller, such as:</p> -<ul> -<li>A clickable trackball that users can move in any direction</li> -<li>A clickable d-pad that allows users to navigate in four directions.</li> -<li>Arrow keys and an OK button that’s equivalent to clicking a trackball or d-pad.</li> -</ul> - -<p>All of these directional controllers allow users to navigate the screen without using the -touchscreen. On some devices, a user can also navigate to the top or bottom of a list by holding -down the <em>alt</em> key while pressing a discrete key for up or down.</p> - -<p>A directional controller is the primary means of navigation for users with visual or some -physical impairments (and also for users without impairments when using devices that don't -have a touchscreen). You should verify that all UI controls in your application are -accessible without using the touchscreen and that clicking with the center button (or OK button) has -the same effect as touching the controls on the touchscreen.</p> - -<p>A UI control (also called a "widget") is accessible using directional controls when it's -"focusable" property is "true." This means that users can focus on the widget using the directional -controls and then interact with it. Widgets provided by the Android APIs are focusable by default -and visually indicate focus by changing the widget visual appearance in some way.</p> - -<p>Android provides several APIs that let you control whether a widget is focusable and even -request that a widget be given focus. Such methods include:</p> - -<ul> - <li>{@link android.view.View#setFocusable setFocusable()}</li> - <li>{@link android.view.View#isFocusable isFocusable()}</li> - <li>{@link android.view.View#requestFocus requestFocus()}</li> -</ul> - -<p>When working with a view that is not focusable by default, you can make it focusable from the XML -layout file by setting the <a -href="{@docRoot}reference/android/view/View.html#attr_android:focusable">{@code -android:focusable}</a> attribute to {@code "true"}.</p> - - - -<h3 id="FocusOrder">Controlling focus order</h3> - -<p>When the user navigates in any direction using the directional controls, focus is passed from one -view to another, as determined by the focus ordering. The ordering of the focus movement is based on -an algorithm that finds the nearest neighbor in a given direction. In rare cases, the default -algorithm may not match the order that you intended for your UI. In these situations, you can -provide explicit overrides to the ordering using the following XML attributes in the layout -file:</p> - -<dl> - <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusDown" ->{@code android:nextFocusDown}</a></dt> - <dd>Defines the next view to receive focus when the user navigates down.</dd> - <a><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusLeft" ->{@code android:nextFocusLeft}</a></dt> - <dd>Defines the next view to receive focus when the user navigates left.</dd> - <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusRight" ->{@code android:nextFocusRight}</a></dt> - <dd>Defines the next view to receive focus when the user navigates right.</dd> - <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusUp" ->{@code android:nextFocusUp}</a></dt> - <dd>Defines the next view to receive focus when the user navigates up.</dd> -</dl> - -<p>For example, here is an XML layout that contains a focusable {@link android.widget.TextView}. -While the {@link android.widget.TextView} is located to the right of the {@link -android.widget.EditText}, it can now be reached by pressing the down arrow when focus is on the -{@link android.widget.EditText}: </p> - -<pre> -<LinearLayout android:orientation="horizontal" - ... > - <EditText android:id="@+id/edit" - android:nextFocusDown=”@+id/text” - ... /> - <TextView android:id="@+id/text" - android:focusable=”true” - android:text="Hello, I am a focusable TextView" - android:nextFocusUp=”@id/edit” - ... /> -</LinearLayout> -</pre> - -<p>When modifying this ordering, be sure that the navigation works as expected in all directions -from each widget and when navigating in reverse (to get back to where you came from).</p> - -<p>You can also modify the focus ordering at runtime, using methods in the {@link -android.view.View} class, such as {@link android.view.View#setNextFocusDownId -setNextFocusDownId()} and {@link android.view.View#setNextFocusRightId -setNextFocusRightId()}.</p> - - -<h3 id="ClickingDpad">Clicking with a directional controller</h3> - -<p>On most devices, clicking a view using a directional controller sends a {@link -android.view.KeyEvent} with {@link android.view.KeyEvent#KEYCODE_DPAD_CENTER} to the view currently -in focus. Make sure this event has the same effect as touching the view on the touchscreen. All -standard Android views already handle {@link android.view.KeyEvent#KEYCODE_DPAD_CENTER} -appropriately.</p> - -<p>If possible, also treat the {@link android.view.KeyEvent#KEYCODE_ENTER} event the same as -{@link android.view.KeyEvent#KEYCODE_DPAD_CENTER}. That makes interaction much easier from a full -keyboard.</p> - - - - -<h2 id="LabelInputs">Label Your Input Widgets</h2> - -<p>Many input widgets rely on visual cues to inform the user of their meaning. For example, a -notepad application might use an {@link android.widget.ImageButton} with a picture of a plus sign to -indicate that the user can add a new note. Or, an {@link android.widget.EditText} may have -a label near it that indicates its purpose. When a visually impaired user accesses your -application, these visual cues are often useless.</p> - -<p>To provide textual information about these widgets (as an alternative to the visual cues), you -should use the <a href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription" ->{@code android:contentDescription}</a> attribute. The text you provide in this attribute -is not visible on the screen, but if a user has enabled accessibility speech tools then the -description in this attribute is read aloud to the user.</p> - -<p>You should set the <a -href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription" >{@code -android:contentDescription}</a> attribute on every {@link android.widget.ImageButton}, {@link -android.widget.EditText}, {@link android.widget.CheckBox}, and on any other input widgets that might -benefit users with extra information.</p> - -<p>For example, the following {@link android.widget.ImageButton} sets the content description for -the plus button to the {@code add_note} string resource, which might be defined in English as -“Add note":</p> - -<pre> -<ImageButton - android:id=”@+id/add_entry_button” - android:src=”@drawable/plus” - android:contentDescription=”@string/add_note”/> -</pre> - -<p>This way, when using speech accessibility tools, the user hears "Add note" when focused on -this widget.</p> - - - -<h2 id="UiBestPractices">Follow Android UI Best Practices</h2> - -<p>You can make it easier for users to learn how to use your application by developing a user -interface that complies with Android's standard interaction patterns, instead of creating your own -or using interaction patterns from another platform. This consistency is especially important for -many disabled users, as they may have less contextual information available to try to understand -your application’s interface.</p> - -<p>Specifically, you should:</p> - -<ul> -<li>Use the platform's built-in widgets and layouts whenever possible, as these views provide -accessibility support by default.</li> -<li>Use the <a href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> as an -alternative to complex touchscreen tasks.</li> -<li>Make sure the BACK button correctly moves the user back one logical step in the <a -href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">task's back stack</a> or the -activity's back stack of fragments (when <a -href="{@docRoot}guide/topics/fundamentals/fragments.html#Transactions">performing fragment -transactions</a>), as appropriate.</li> -</ul> - - - -<h2 id="CustomViews">Send Accessibility Events from Custom View Components</h2> - -<p>If your application requires that you create a <a -href="{@docRoot}guide/topics/ui/custom-components.html">custom view component</a>, you may need to -do some additional work to ensure that your view is accessible. Specifically, you should make sure -that your view implements the {@link android.view.accessibility.AccessibilityEventSource} -interface and emits {@link android.view.accessibility.AccessibilityEvent}s at the proper times, -and that each {@link android.view.accessibility.AccessibilityEvent} contains relevant information -about the state of the view.</p> - -<p>Events are emitted whenever something notable happens in the user interface. Currently, there -are five types of accessibility events that a view should send to the system as the user interacts -with it:</p> - -<dl> -<dt>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CLICKED}</dt> -<dd>Indicates that the user clicked on the view (for example, the user selects a button).</dd> - -<dt>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_LONG_CLICKED}</dt> -<dd>Indicates that the user performed a long press on the view. </dd> - -<dt>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_SELECTED}</dt> -<dd>Indicates that the user selected an item from within the view. This is usually used in the -context of an {@link android.widget.AdapterView}.</dd> - -<dt>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_FOCUSED}</dt> -<dd>Indicates that the user moved the focus to the view.</dd> - -<dt>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED}</dt> -<dd>Indicates that the text or contents of the view changed.</dd> -</dl> - - -<p>The basic {@link android.view.View} class implements {@link -android.view.accessibility.AccessibilityEventSource} and emits these events at the proper time in -the standard cases. Your custom view should extend from {@link android.view.View} (or one of its -subclasses) to take advantage of these default implementations.</p> - -<p>Depending on the specifics of your custom view, your view may need to emit one of these events at -a different time than the default {@link android.view.View} implementation. To do so, simply call -{@link android.view.accessibility.AccessibilityEventSource#sendAccessibilityEvent -sendAccessibilityEvent()} with the specific event type at the correct time.</p> - -<p>For example, say you are implementing a custom slider bar that allows the user to select a -numeric value by pressing the left or right arrows. This view should emit an event of type {@link -android.view.accessibility.AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} whenever the slider value -changes:</p> - -<pre> -@Override -public boolean onKeyUp (int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { - mCurrentValue--; - sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED); - return true; - } - ... -} -</pre> - -<p>Each {@link android.view.accessibility.AccessibilityEvent} has a set of required properties that -describe the current state of the view. These properties include things like the view’s class name, -text and checked state. The specific properties required for each event type are described in the -{@link android.view.accessibility.AccessibilityEvent} documentation. The {@link android.view.View} -implementation will fill in default values for these properties. Most of these values, like the -class name and event timestamp, will not need to be changed. However, depending on the specifics of -your custom view, you may want to provide a different value for one or more of the properties. For -example, your view may have additional state information that you want to add to the event text.</p> - -<p>The {@link android.view.View#dispatchPopulateAccessibilityEvent -dispatchPopulateAccessibilityEvent()} method in {@link android.view.View} provides a hook for making -changes to the {@link android.view.accessibility.AccessibilityEvent} object before it is -emitted.</p> - -<p>In the above slider bar example, the view should add the current value of the slider bar to the -text of the event:</p> - -<pre> -@Override -public boolean dispatchPopulateAccessibilityEvent(final AccessibilityEvent event) { - super.dispatchPopulateAccessibilityEvent(event); - if (!isShown()) { - return false; - } - CharSequence text = String.valueOf(mCurrentValue); - if (text.length() > AccessibilityEvent.MAX_TEXT_LENGTH) { - text = text.subSequence(0, AccessiblityEvent.MAX_TEXT_LENGTH); - } - event.getText().add(text); - return true; -} -</pre> - - -<h2 id="Test">Test Your Application’s Accessibility</h2> - -<p>You can simulate the experience for many users by enabling an accessibility service that speaks -as you move around the screen. One such service is <a -href="https://play.google.com/store/details?id=com.google.android.marvin.talkback">TalkBack</a>, by the -<a href="http://code.google.com/p/eyes-free/">Eyes-Free Project</a>. It comes preinstalled on many -Android-powered devices, but is also available for free from the <a -href="https://play.google.com/store/details?id=com.google.android.marvin.talkback">Google Play</a> store.</p> - -<p>This service requires that you have a text-to-speech engine installed on your phone. You can -verify if you have one installed in the <strong>Text-to-speech</strong> settings menu by selecting -<strong>Listen to an example</strong>. If you do not hear anything spoken, install the required -voice data by selecting <strong>Install voice data</strong>.</p> - -<p>Once text-to-speech is functioning correctly, you can enable TalkBack (or another accessibility -service) in the <strong>Accessibility</strong> settings menu. Enable both -<strong>Accessibility</strong> and <strong>TalkBack</strong>. As you navigate about the device, you -should now hear spoken feedback.</p> - -<p>You can now attempt to use your application as a blind user would. As you move around using only -the directional controller, make sure that the spoken feedback you hear makes sense and is -sufficient to navigate the application without any visual cues.</p> diff --git a/docs/html/guide/practices/optimizing-for-3.0.jd b/docs/html/guide/practices/optimizing-for-3.0.jd index 140c50ca52f5..d6c621ea4287 100644 --- a/docs/html/guide/practices/optimizing-for-3.0.jd +++ b/docs/html/guide/practices/optimizing-for-3.0.jd @@ -108,7 +108,7 @@ SDK with the new platform:</p> SDK starter package now</a>.)</p> <ol> - <li><a href="{@docRoot}sdk/adding-components.html#launching">Launch the Android SDK and AVD + <li><a href="{@docRoot}sdk/adding-components.html#launching">Launch the Android SDK Manager</a> and install the following: <ul> <li>SDK Platform Android 3.0</li> @@ -147,7 +147,7 @@ Android 3.0, the emulator is still best way to evaluate your application's appea functionality on Android 3.0.</p> <p class="note"><strong>Tip:</strong> To improve the startup time for the emulator, enable snapshots -for the AVD when you create it with the SDK and AVD Manager (there's a checkbox in the AVD creator +for the AVD when you create it with the AVD Manager (there's a checkbox in the AVD creator to <strong>Enable</strong> snapshots). Then, start the AVD from the AVD manager and check <b>Launch from snapshot</b> and <b>Save to snapshot</b>. This way, when you close the emulator, a snapshot of the AVD state is saved and used to quickly relaunch the AVD next time. However, when you choose to @@ -281,7 +281,7 @@ to help you add features from Android 3.0 without requiring you to change your < href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a> or build target, we're providing a static library called the <a href="{@docRoot}sdk/compatibility-library.html">Compatibility Library</a> -(downloadable from the AVD and SDK Manager).</p> +(downloadable from the Android SDK Manager).</p> <p>This library includes APIs for <a href="{@docRoot}guide/topics/fundamentals/fragments.html">fragments</a>, <a href="{@docRoot}guide/topics/fundamentals/loaders.html">loaders</a>, and some updated classes. By @@ -421,7 +421,7 @@ href="{@docRoot}sdk/android-3.0.html">Android 3.0 Platform</a> document.</p> href="{@docRoot}sdk/android-3.0.html#api">Android 3.0 Platform</a> document also have accompanying samples that allow you to preview the effects and can help you understand how to use them. To get the samples, download them from the SDK repository <a href="{@docRoot}sdk/adding-components.html" ->using the Android SDK and AVD Manager</a>. After downloading the samples ("Samples for SDK API +>using the Android SDK Manager</a>. After downloading the samples ("Samples for SDK API 11"), you can find them in <code><sdk_root>/samples/android-11/</code>. The following list provides links to the browsable source code for some of the samples:</p> diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd index 29dff261335e..a870b223c6ac 100644 --- a/docs/html/guide/practices/screens_support.jd +++ b/docs/html/guide/practices/screens_support.jd @@ -1242,12 +1242,12 @@ have to buy various devices just to test your application's screen support.</p> <p>To set up an environment for testing your application's screen support, you should create a series of AVDs (Android Virtual Devices), using emulator skins and screen configurations that emulate the screen sizes and densities you want your application to support. To do so, you can use -the Android SDK and AVD Manager to create the AVDs and launch them with a graphical interface.</p> +the AVD Manager to create the AVDs and launch them with a graphical interface.</p> -<p>To launch the Android SDK and AVD Manager, execute the {@code +<p>To launch the Android SDK Manager, execute the {@code SDK Manager.exe} from your Android SDK directory (on Windows only) or execute {@code android} from -the {@code <sdk>/tools/} directory (on all platforms). Figure 6 shows the Android SDK and -AVD Manager with a selection of AVDs, for testing various screen configurations.</p> +the {@code <sdk>/tools/} directory (on all platforms). Figure 6 shows the AVD +Manager with a selection of AVDs, for testing various screen configurations.</p> <p>Table 3 shows the various emulator skins that are available in the Android SDK, which you can use to emulate some of the most common screen configurations.</p> @@ -1340,7 +1340,7 @@ dashboard.</p> <div class="figure" style="width:204px"> <img src="{@docRoot}images/screens_support/avd-start.png" alt="" /> <p class="img-caption"><strong>Figure 7.</strong> - Size and density options you can set, when starting an AVD from the Android SDK and AVD + Size and density options you can set, when starting an AVD from the AVD Manager.</p> </div> @@ -1349,12 +1349,12 @@ up to run at a physical size that closely matches an actual device. This makes it a lot easier to compare the results at various sizes and densities. To do so you need to know the approximate density, in dpi, of your computer monitor (for instance, a 30" Dell monitor has a density of about 96 dpi). When you launch an AVD -from the Android SDK and AVD Manager, you can specify the screen size for the emulator and your +from the AVD Manager, you can specify the screen size for the emulator and your monitor dpi in the Launch Options, as shown in figure 7.</p> <p>If you would like to test your application on a screen that uses a resolution or density not supported by the built-in skins, you can create an AVD that uses a custom resolution -or density. When creating the AVD from the Android SDK and AVD Manager, specify the Resolution, +or density. When creating the AVD from the AVD Manager, specify the Resolution, instead of selecting a Built-in Skin.</p> <p>If you are launching your AVD from the command line, you can specify the scale for diff --git a/docs/html/guide/publishing/app-signing.jd b/docs/html/guide/publishing/app-signing.jd index e86ec301c25c..5bd9be559497 100644 --- a/docs/html/guide/publishing/app-signing.jd +++ b/docs/html/guide/publishing/app-signing.jd @@ -66,7 +66,7 @@ on an emulator or a device if it is not signed.</li> application's signer certificate expires after the application is installed, the application will continue to function normally.</li> <li>You can use standard tools — Keytool and Jarsigner — to generate keys and -sign your application .apk files.</li> +sign your application {@code .apk} files.</li> <li>After you sign your application for release, we recommend that you use the <code>zipalign</code> tool to optimize the final APK package.</li> </ul> @@ -186,9 +186,9 @@ to the Keytool in the JDK.</p> <p>The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application, while still meeting the Android system -requirement for signing your .apk. +requirement for signing your APK. When using debug mode to build your app, the SDK tools invoke Keytool to automatically create -a debug keystore and key. This debug key is then used to automatically sign the .apk, so +a debug keystore and key. This debug key is then used to automatically sign the APK, so you do not need to sign the package with your own key.</p> <p>The SDK tools create the debug keystore/key with predetermined names/passwords:</p> @@ -215,19 +215,19 @@ to the public when signed with the debug certificate.</p> <p>If you are developing in Eclipse/ADT (and have set up Keytool and Jarsigner as described above in <a href="#setup">Basic Setup for Signing</a>), signing in debug mode is enabled by default. When you run or debug your -application, ADT signs the .apk with the debug certificate, runs {@code zipalign} on the -package, then installs it on +application, ADT signs the {@code .apk} file with the debug certificate, runs {@code zipalign} on +the package, then installs it on the selected emulator or connected device. No specific action on your part is needed, provided ADT has access to Keytool.</p> <h3>Ant Users</h3> -<p>If you are using Ant to build your .apk files, debug signing mode +<p>If you are using Ant to build your {@code .apk} file, debug signing mode is enabled by using the <code>debug</code> option with the <code>ant</code> command (assuming that you are using a <code>build.xml</code> file generated by the <code>android</code> tool). When you run <code>ant debug</code> to -compile your app, the build script generates a keystore/key and signs the .apk for you. -The script then also aligns the .apk with the <code>zipalign</code> tool. +compile your app, the build script generates a keystore/key and signs the APK for you. +The script then also aligns the APK with the <code>zipalign</code> tool. No other action on your part is needed. Read <a href="{@docRoot}guide/developing/building/building-cmdline.html#DebugMode">Building and Running Apps on the Command Line</a> for more information.</p> @@ -383,8 +383,8 @@ will use later, to refer to this keystore when signing your application. </p> <p>For more information about Keytool, see the documentation at <a -href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security"> -http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security</a></p> +href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html"> +http://docs.oracle.com/javase/6/docs/technotes/tools/windows/keytool.html</a></p> @@ -399,11 +399,11 @@ You can not release your application unsigned, or signed with the debug key.</p> <h4>With Eclipse</h4> -<p>To export an <em>unsigned</em> .apk from Eclipse, right-click the project in the Package +<p>To export an <em>unsigned</em> APK from Eclipse, right-click the project in the Package Explorer and select <strong>Android Tools</strong> > <strong>Export Unsigned Application -Package</strong>. Then specify the file location for the unsigned .apk. -(Alternatively, open your <code>AndroidManifest.xml</code> file in Eclipse, open -the <em>Overview</em> tab, and click <strong>Export an unsigned .apk</strong>.)</p> +Package</strong>. Then specify the file location for the unsigned APK. +(Alternatively, open your <code>AndroidManifest.xml</code> file in Eclipse, select +the <strong>Manifest</strong> tab, and click <strong>Export an unsigned APK</strong>.)</p> <p>Note that you can combine the compiling and signing steps with the Export Wizard. See <a href="#ExportWizard">Compiling and signing with Eclipse ADT</a>.</p> @@ -414,11 +414,11 @@ the <em>Overview</em> tab, and click <strong>Export an unsigned .apk</strong>.)< with the <code>ant</code> command. For example, if you are running Ant from the directory containing your {@code build.xml} file, the command would look like this:</p> -<pre>ant release</pre> +<pre>$ ant release</pre> -<p>By default, the build script compiles the application .apk without signing it. The output file +<p>By default, the build script compiles the application APK without signing it. The output file in your project {@code bin/} will be <code><em><your_project_name></em>-unsigned.apk</code>. -Because the application .apk is still unsigned, you must manually sign it with your private +Because the application APK is still unsigned, you must manually sign it with your private key and then align it using {@code zipalign}.</p> <p>However, the Ant build script can also perform the signing @@ -443,8 +443,8 @@ machine, as described in <a href="#setup">Basic Setup</a>. Also, make sure that the keystore containing your private key is available.</p> <p>To sign your application, you run Jarsigner, referencing both the -application's .apk and the keystore containing the private key with which to -sign the .apk. The table below shows the options you could use. </p> +application's APK and the keystore containing the private key with which to +sign the APK. The table below shows the options you could use. </p> <table> <tr> @@ -459,6 +459,14 @@ the keystore containing your private key.</td> <td><code>-verbose</code></td><td>Enable verbose output.</td> </tr> <tr> +<td><code>-sigalg</code></td><td>The name of the signature algorithim to use in signing the APK. +Use the value {@code MD5withRSA}.</td> +</tr> +<tr> +<td><code>-digestalg</code></td><td>The message digest algorithim to use in processing the entries +of an APK. Use the value {@code SHA1}.</td> +</tr> +<tr> <td><code>-storepass <password></code></td><td><p>The password for the keystore. </p><p>As a security precaution, do not include this option in your command line unless you are working at a secure computer. @@ -478,19 +486,23 @@ way, your password is not stored in your shell history.</p></td> <code>my_application.apk</code>, using the example keystore created above. </p> -<pre>$ jarsigner -verbose -keystore my-release-key.keystore +<pre>$ jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name</pre> <p>Running the example command above, Jarsigner prompts you to provide -passwords for the keystore and key. It then modifies the .apk -in-place, meaning the .apk is now signed. Note that you can sign an -.apk multiple times with different keys.</p> +passwords for the keystore and key. It then modifies the APK +in-place, meaning the APK is now signed. Note that you can sign an +APK multiple times with different keys.</p> + +<p class="caution"><strong>Caution:</strong> As of JDK 7, the default signing algorithim has +changed, requiring you to specify the signature and digest algorithims ({@code -sigalg} and {@code +-digestalg}) when you sign an APK.</p> -<p>To verify that your .apk is signed, you can use a command like this:</p> +<p>To verify that your APK is signed, you can use a command like this:</p> <pre>$ jarsigner -verify my_signed.apk</pre> -<p>If the .apk is signed properly, Jarsigner prints "jar verified". +<p>If the APK is signed properly, Jarsigner prints "jar verified". If you want more details, you can try one of these commands:</p> <pre>$ jarsigner -verify -verbose my_application.apk</pre> @@ -502,19 +514,19 @@ If you want more details, you can try one of these commands:</p> <p>The command above, with the <code>-certs</code> option added, will show you the "CN=" line that describes who created the key.</p> -<p class="note"><strong>Note:</strong> If you see "CN=Android Debug", this means the .apk was +<p class="note"><strong>Note:</strong> If you see "CN=Android Debug", this means the APK was signed with the debug key generated by the Android SDK. If you intend to release your application, you must sign it with your private key instead of the debug key.</p> <p>For more information about Jarsigner, see the documentation at -<a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security"> -http://java.sun.com/j2se/1.5.0/docs/tooldocs/#security</a></p> +<a href="http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html"> +http://docs.oracle.com/javase/6/docs/technotes/tools/windows/jarsigner.html</a></p> <h3 id="align">4. Align the final APK package</h3> -<p>Once you have signed the .apk with your private key, run <code>zipalign</code> on the file. +<p>Once you have signed the APK with your private key, run <code>zipalign</code> on the file. This tool ensures that all uncompressed data starts with a particular byte alignment, relative to the start of the file. Ensuring alignment at 4-byte boundaries provides a performance optimization when installed on a device. When aligned, the Android @@ -524,16 +536,16 @@ of the data from the package. The benefit is a reduction in the amount of RAM consumed by the running application.</p> <p>The <code>zipalign</code> tool is provided with the Android SDK, inside the -<code>tools/</code> directory. To align your signed .apk, execute:</p> +<code>tools/</code> directory. To align your signed APK, execute:</p> -<pre>zipalign -v 4 <em>your_project_name</em>-unaligned.apk <em>your_project_name</em>.apk</pre> +<pre>$ zipalign -v 4 <em>your_project_name</em>-unaligned.apk <em>your_project_name</em>.apk</pre> <p>The {@code -v} flag turns on verbose output (optional). {@code 4} is the byte-alignment (don't use anything other than 4). The first file argument is -your signed .apk (the input) and the second file is the destination .apk file (the output). -If you're overriding an existing .apk, add the {@code -f} flag.</p> +your signed {@code .apk} file (the input) and the second file is the destination {@code .apk} file +(the output). If you're overriding an existing APK, add the {@code -f} flag.</p> -<p class="caution"><strong>Caution:</strong> Your input .apk must be signed with your +<p class="caution"><strong>Caution:</strong> Your input APK must be signed with your private key <strong>before</strong> you optimize the package with {@code zipalign}. If you sign it after using {@code zipalign}, it will undo the alignment.</p> @@ -544,7 +556,7 @@ If you sign it after using {@code zipalign}, it will undo the alignment.</p> <h3 id="ExportWizard">Compile and sign with Eclipse ADT</h3> <p>If you are using Eclipse with the ADT plugin, you can use the Export Wizard to -export a <em>signed</em> .apk (and even create a new keystore, +export a <em>signed</em> APK (and even create a new keystore, if necessary). The Export Wizard performs all the interaction with the Keytool and Jarsigner for you, which allows you to sign the package using a GUI instead of performing the manual procedures to compile, sign, @@ -554,7 +566,7 @@ Because the Export Wizard uses both Keytool and Jarsigner, you should ensure that they are accessible on your computer, as described above in the <a href="#setup">Basic Setup for Signing</a>.</p> -<p>To create a signed and aligned .apk in Eclipse:</p> +<p>To create a signed and aligned APK in Eclipse:</p> <ol> <li>Select the project in the Package @@ -563,7 +575,7 @@ Explorer and select <strong>File > Export</strong>.</li> and click <strong>Next</strong>. <p>The Export Android Application wizard now starts, which will guide you through the process of signing your application, - including steps for selecting the private key with which to sign the .apk + including steps for selecting the private key with which to sign the APK (or creating a new keystore and private key).</p> <li>Complete the Export Wizard and your application will be compiled, signed, aligned, and ready for distribution.</li> diff --git a/docs/html/guide/topics/location/index.jd b/docs/html/guide/topics/location/index.jd index 5f98902cf701..8a2e9cdb2bae 100644 --- a/docs/html/guide/topics/location/index.jd +++ b/docs/html/guide/topics/location/index.jd @@ -98,7 +98,7 @@ Google APIs add-on, visit</p> href="http://code.google.com/android/add-ons/google-apis">http://code.google.com/android/add-ons/google-apis</a></p> <p>For your convenience, the Google APIs add-on is also available as a downloadable component from -the Android SDK and AVD Manager (see <a href="{@docRoot}sdk/adding-components.html">Adding SDK +the Android SDK Manager (see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>).</p> <p class="note"><strong>Note:</strong> In order to display Google Maps data in a diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd index 9175566cb36e..5f0a501c3670 100644 --- a/docs/html/guide/topics/manifest/uses-feature-element.jd +++ b/docs/html/guide/topics/manifest/uses-feature-element.jd @@ -501,7 +501,7 @@ If you are using SDK Tools r8 or higher, you can find <code>aapt</code> in the <p class="note"><strong>Note:</strong> You must use the version of <code>aapt</code> that is provided for the latest Platform-Tools component available. If you do not have the latest Platform-Tools component, download it using the <a -href="{@docRoot}sdk/adding-components.html">Android SDK and AVD Manager</a>. +href="{@docRoot}sdk/adding-components.html">Android SDK Manager</a>. </p></li> <li>Run <code>aapt</code> using this syntax: </li> </ol> diff --git a/docs/html/guide/topics/ui/accessibility/apps.jd b/docs/html/guide/topics/ui/accessibility/apps.jd new file mode 100644 index 000000000000..ff34be64ee20 --- /dev/null +++ b/docs/html/guide/topics/ui/accessibility/apps.jd @@ -0,0 +1,570 @@ +page.title=Making Applications Accessible +parent.title=Accessibility +parent.link=index.html +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> + + <h2>In this document</h2> + <ol> + <li><a href="#label-ui">Labeling User Interface Elements</a></li> + <li><a href="#focus-nav">Enabling Focus Navigation</a> + <ol> + <li><a href="#focus-enable">Enabling view focus</a></li> + <li><a href="#focus-order">Controlling focus order</a></li> + </ol> + </li> + <li><a href="#custom-views">Building Accessible Custom Views</a> + <ol> + <li><a href="#directional-control">Handling directional controller clicks</a></li> + <li><a href="#accessibility-methods">Implementing accessibility API methods</a></li> + <li><a href="#send-events">Sending accessibility events</a></li> + <li><a href="#populate-events">Populating accessibility events</a></li> + </ol> + </li> + <li><a href="#test">Testing Accessibility</a> + <ol> + <li><a href="#test-audibles">Testing audible feedback</a></li> + <li><a href="#test-navigation">Testing focus navigation</a></li> + </ol> + </li> + </ol> + + <h2>Key classes</h2> + <ol> + <li>{@link android.view.accessibility.AccessibilityEvent}</li> + <li>{@link android.view.accessibility.AccessibilityNodeInfo}</li> + <li>{@link android.support.v4.view.accessibility.AccessibilityNodeInfoCompat}</li> + <li>{@link android.view.View.AccessibilityDelegate}</li> + <li>{@link android.support.v4.view.AccessibilityDelegateCompat}</li> + </ol> + + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}training/accessibility/index.html">Implementing Accessibility</a></li> + <li><a href="{@docRoot}training/design-navigation/index.html">Designing Effective Navigation</a> + </li> + <li><a href="{@docRoot}design/index.html">Android Design</a></li> + </ol> + +</div> +</div> + +<p>Applications built for Android are accessible to users with visual, physical or age-related +disabilities when they activate accessibility features and services on a device. By default, +these services make your application more accessible. However, there are further steps you should +take to optimize the accessibility of your application and ensure a pleasant experience for all your +users.</p> + +<p>Making sure your application is accessible to all users is relatively easy, particularly when you +use framework-provided user interface components. If you only use these standard components for your +application, there are just a few steps required to ensure your application is accessible:</p> + +<ol> + <li>Label your {@link android.widget.ImageButton}, {@link android.widget.ImageView}, {@link +android.widget.EditText}, {@link android.widget.CheckBox} and other user interface controls using +the <a href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription"> + {@code android:contentDescription}</a> attribute.</li> + <li>Make all of your user interface elements accessible with a directional controller, + such as a trackball or D-pad.</li> + <li>Test your application by turning on accessibility services like TalkBack and Explore by + Touch, and try using your application using only directional controls.</li> +</ol> + +<p>Developers who create custom controls that extend from the {@link android.view.View} class have +some additional responsibilities for making sure their components are accessible for users. This +document also discusses how to make custom view controls compatible with accessibility services.</p> + + +<h2 id="label-ui">Labeling User Interface Elements</h2> + +<p>Many user interface controls rely on visual cues to inform users of their meaning. For +example, a note-taking application might use an {@link android.widget.ImageButton} with a +picture of a plus sign to indicate that the user can add a new note. Or, an {@link +android.widget.EditText} component may have a label near it that indicates its purpose. When a user +with impaired vision accesses your application, these visual cues are often useless.</p> + +<p>To provide textual information about interface controls (as an alternative to the visual cues), +use the <a href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription"> +{@code android:contentDescription}</a> attribute. The text you provide in this attribute is not +visible on the screen, but if a user has enabled accessibility services that provide audible +prompts, then the description in this attribute is read aloud to the user.</p> + +<p>Set the <a href="{@docRoot}reference/android/view/View.html#attr_android:contentDescription"> +{@code android:contentDescription}</a> attribute for every {@link android.widget.ImageButton}, +{@link android.widget.ImageView}, {@link android.widget.EditText}, {@link android.widget.CheckBox} +in your application's user interface, and on any other input controls that might require additional +information for users who are not able to see it.</p> + +<p>For example, the following {@link android.widget.ImageButton} sets the content description for +the plus button to the {@code add_note} string resource, which could be defined as “Add note" for an +English language interface:</p> + +<pre> +<ImageButton + android:id=”@+id/add_note_button” + android:src=”@drawable/add_note” + android:contentDescription=”@string/add_note”/> +</pre> + +<p>By including the description, speech-based accessibility services can announce "Add note" when a +user moves focus to this button or hovers over it.</p> + +<p class="note">Note: For {@link android.widget.EditText} fields, provide an +<a href="{@docRoot}reference/android/widget/TextView.html#attr_android:hint">android:hint</a> +attribute to help users understand what content is expected.</p> + +<h2 id="focus-nav">Enabling Focus Navigation</h2> + +<p>Focus navigation allows users with disabilities to step through user interface controls using a +directional controller. Directional controllers can be physical, such as a clickable trackball, +directional pad (D-Pad) or arrow keys, tab key navigation with an attached keyboard or a software +application that provides an on-screen directional control.</p> + +<p>A directional controller is a primary means of navigation for many users. +Verify that all user interface (UI) controls in your application are accessible +without using the touchscreen and that clicking with the center button (or OK button) of a +directional controller has the same effect as touching the controls on the touchscreen. For +information on testing directional controls, see <a href="#test-navigation">Testing focus +navigation</a>.</p> + +<h3 id="focus-enable">Enabling view focus</h3> + +<p>A user interface element is accessible using directional controls when its +<a href="{@docRoot}reference/android/view/View.html#attr_android:focusable"> +{@code android:focusable}</a> attribute is set to {@code true}. This setting allows users to focus +on the element using the directional controls and then interact with it. The user interface controls +provided by the Android framework are focusable by default and visually indicate focus by changing +the control’s appearance.</p> + +<p>Android provides several APIs that let you control whether a user interface control is focusable +and even request that a control be given focus:</p> + +<ul> + <li>{@link android.view.View#setFocusable setFocusable()}</li> + <li>{@link android.view.View#isFocusable isFocusable()}</li> + <li>{@link android.view.View#requestFocus requestFocus()}</li> +</ul> + +<p>When working with a view that is not focusable by default, you can make it focusable from the XML +layout file by setting the +<a href="{@docRoot}reference/android/view/View.html#attr_android:focusable"> +{@code android:focusable}</a> attribute to {@code true} or by using the {@link +android.view.View#setFocusable setFocusable()} method.</p> + +<h3 id="focus-order">Controlling focus order</h3> + +<p>When users navigate in any direction using directional controls, focus is passed from one +user interface element (View) to another, as determined by the focus ordering. The ordering of the +focus movement is based on an algorithm that finds the nearest neighbor in a given direction. In +rare cases, the default algorithm may not match the order that you intended for your UI. In these +situations, you can provide explicit overrides to the ordering using the following XML attributes in +the layout file:</p> + +<dl> + <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusDown" +>{@code android:nextFocusDown}</a></dt> + <dd>Defines the next view to receive focus when the user navigates down.</dd> + <a><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusLeft" +>{@code android:nextFocusLeft}</a></dt> + <dd>Defines the next view to receive focus when the user navigates left.</dd> + <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusRight" +>{@code android:nextFocusRight}</a></dt> + <dd>Defines the next view to receive focus when the user navigates right.</dd> + <dt><a href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusUp" +>{@code android:nextFocusUp}</a></dt> + <dd>Defines the next view to receive focus when the user navigates up.</dd> +</dl> + +<p>The following example XML layout shows two focusable user interface elements where the <a +href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusDown" +>{@code android:nextFocusDown}</a> and <a +href="{@docRoot}reference/android/view/View.html#attr_android:nextFocusUp" +>{@code android:nextFocusUp}</a> attributes have been explicitly set. The {@link android.widget.TextView} is +located to the right of the {@link android.widget.EditText}. However, since these properties have +been set, the {@link android.widget.TextView} element can now be reached by pressing the down arrow +when focus is on the {@link android.widget.EditText} element: </p> + +<pre> +<LinearLayout android:orientation="horizontal" + ... > + <EditText android:id="@+id/edit" + android:nextFocusDown=”@+id/text” + ... /> + <TextView android:id="@+id/text" + android:focusable=”true” + android:text="Hello, I am a focusable TextView" + android:nextFocusUp=”@id/edit” + ... /> +</LinearLayout> +</pre> + +<p>When modifying focus order, be sure that the navigation works as expected in all directions from +each user interface control and when navigating in reverse (to get back to where you came from).</p> + +<p class="note"><strong>Note:</strong> You can modify the focus order of user interface components +at runtime, using methods such as {@link android.view.View#setNextFocusDownId setNextFocusDownId()} +and {@link android.view.View#setNextFocusRightId setNextFocusRightId()}.</p> + + +<h2 id="custom-views">Building Accessible Custom Views</h2> + +<p>If your application requires a <a href="{@docRoot}guide/topics/ui/custom-components.html">custom +view component</a>, you must do some additional work to ensure that your custom view is accessible. +These are the main tasks for ensuring the accessibility of your view:</p> + +<ul> + <li>Handle directional controller clicks</li> + <li>Implement Accessibility API methods</li> + <li>Send {@link android.view.accessibility.AccessibilityEvent} objects specific to your custom view</li> + <li>Populate {@link android.view.accessibility.AccessibilityEvent} and {@link + android.view.accessibility.AccessibilityNodeInfo} for your view</li> +</ul> + + +<h3 id="directional-control">Handling directional controller clicks</h3> + +<p>On most devices, clicking a view using a directional controller sends a {@link +android.view.KeyEvent} with {@link android.view.KeyEvent#KEYCODE_DPAD_CENTER} to the view currently +in focus. All standard Android views already handle {@link +android.view.KeyEvent#KEYCODE_DPAD_CENTER} appropriately. When building a custom {@link +android.view.View} control, make sure this event has the same effect as touching the view on the +touchscreen. </p> + +<p>Your custom control should also treat the {@link android.view.KeyEvent#KEYCODE_ENTER} event the +same as {@link android.view.KeyEvent#KEYCODE_DPAD_CENTER}. This approach makes interaction from a +full keyboard much easier for users.</p> + + +<h3 id="accessibility-methods">Implementing accessibility API methods</h3> + +<p>Accessibility events are messages about users interaction with visual interface components in +your application. These messages are handled by <a href="services.html">Accessibility Services</a>, +which use the information in these events to produce supplemental feedback and prompts when users +have enabled accessibility services. As of Android 4.0 (API Level 14) and higher, the methods for +generating accessibility events have been expanded to provide more detailed information beyond the +{@link android.view.accessibility.AccessibilityEventSource} interface introduced in Android 1.6 (API +Level 4). The expanded accessibility methods are part of the {@link android.view.View} class as well +as the {@link android.view.View.AccessibilityDelegate} class. The methods are as follows:</p> + +<dl> + <dt>{@link android.view.View#sendAccessibilityEvent sendAccessibilityEvent()}</dt> + <dd>(API Level 4) This method is called when a user takes action on a view. The event is +classified with a user action type such as {@link +android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CLICKED TYPE_VIEW_CLICKED}. You typically do +not need to implement this method unless you are creating a custom view.</dd> + + <dt>{@link android.view.View#sendAccessibilityEventUnchecked +sendAccessibilityEventUnchecked()}</dt> + <dd>(API Level 4) This method is used when the calling code needs to directly control the check +for accessibility being enabled on the device ({@link +android.view.accessibility.AccessibilityManager#isEnabled AccessibilityManager.isEnabled()}). If +you do implement this method, you must assume that the calling method has already checked that +accessibility is enabled and the result is {@code true}. You typically do not need to implement this +method for a custom view.</dd> + + <dt>{@link android.view.View#dispatchPopulateAccessibilityEvent +dispatchPopulateAccessibilityEvent()} </dt> + <dd>(API Level 4) The system calls this method when your custom view generates an +accessibility event. As of API Level 14, the default implementation of this method calls {@link +android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()} for this view and +then the {@link android.view.View#dispatchPopulateAccessibilityEvent +dispatchPopulateAccessibilityEvent()} method for each child of this view. In order to support +accessibility services on revisions of Android <em>prior</em> to 4.0 (API Level 14) you +<em>must</em> override this method and populate {@link +android.view.accessibility.AccessibilityEvent#getText} with descriptive text for your custom +view.</dd> + + <dt>{@link android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()}</dt> + <dd>(API Level 14) This method sets the text output of an {@link +android.view.accessibility.AccessibilityEvent} for your view. This method is also called if the +view is a child of a view which generates an accessibility event. + + <p class="note"><strong>Note:</strong> Modifying additional attributes beyond the text within +this method potentially overwrites properties set by other methods. So, while you are able modify +attributes of the accessibility event with this method, you should limit these changes +to text content only and use the {@link android.view.View#onInitializeAccessibilityEvent +onInitializeAccessibilityEvent()} method to modify other properties of the event.</p> + + <p class="note"><strong>Note:</strong> If your implementation of this event calls for completely +overiding the output text without allowing other parts of your layout to modify its content, then +do not call the super implementation of this method in your code.</p> + </dd> + + <dt>{@link android.view.View#onInitializeAccessibilityEvent onInitializeAccessibilityEvent()}</dt> + <dd>(API Level 14) The system calls this method to obtain additional information about the +state of the view, beyond text content. If your custom view provides interactive control beyond a +simple {@link android.widget.TextView} or {@link android.widget.Button}, you should override this +method and set the additional information about your view into the event using this method, such as +password field type, checkbox type or states that provide user interaction or feedback. If you +do override this method, you must call its super implementation and then only modify properties +that have not been set by the super class.</dd> + + <dt>{@link android.view.View#onInitializeAccessibilityNodeInfo +onInitializeAccessibilityNodeInfo()}</dt> + <dd>(API Level 14) This method provides accessibility services with information about the state of +the view. The default {@link android.view.View} implementation sets a standard set of view +properties, but if your custom view provides interactive control beyond a simple {@link +android.widget.TextView} or {@link android.widget.Button}, you should override this method and set +the additional information about your view into the {@link +android.view.accessibility.AccessibilityNodeInfo} object handled by this method.</dd> + + <dt>{@link android.view.ViewGroup#onRequestSendAccessibilityEvent +onRequestSendAccessibilityEvent()}</dt> + <dd>(API Level 14) The system calls this method when a child of your view has generated an +{@link android.view.accessibility.AccessibilityEvent}. This step allows the the parent view to amend +the accessibility event with additional information. You should implement this method only if your +custom view can have child views and if the parent view can provide context information to the +accessibility event that would be useful to accessibility services.</dd> +</dl> + +<p>In order to support these accessibility methods for a custom view, you should take one of the +following approaches:</p> + +<ul> + <li>If your application targets Android 4.0 (API level 14) and higher, override and implement the +accessibility methods listed above directly in your custom view class.</li> + <li>If your custom view is intended to be compatible with Android 1.6 (API Level 4) and above, add +the Android <a href="{@docRoot}sdk/compatibility-library.html">Support Library</a>, revision 5 or +higher, to your project. Then, within your custom view class, call the +{@link android.support.v4.view.ViewCompat#setAccessibilityDelegate +ViewCompat.setAccessibilityDelegate()} method to implement the accessibility methods +above. For an example of this approach, see the Android Support Library (revision 5 or higher) +sample {@code AccessibilityDelegateSupportActivity} in +({@code <sdk>/extras/android/support/v4/samples/Support4Demos/}) + </li> +</ul> + +<p>In either case, you should implement the following accessibility methods for your custom view +class:</p> + +<ul> + <li>{@link android.view.View#dispatchPopulateAccessibilityEvent + dispatchPopulateAccessibilityEvent()}</li> + <li>{@link android.view.View#onPopulateAccessibilityEvent + onPopulateAccessibilityEvent()}</li> + <li>{@link android.view.View#onInitializeAccessibilityEvent + onInitializeAccessibilityEvent()}</li> + <li>{@link android.view.View#onInitializeAccessibilityNodeInfo + onInitializeAccessibilityNodeInfo()}</li> +</ul> + +<p>For more information about implementing these methods, see <a href="#populate-events">Populating +Accessibility Events</a>.</p> + + +<h3 id="send-events">Sending accessibility events</h3> + +<p>Depending on the specifics of your custom view, it may need to send {@link +android.view.accessibility.AccessibilityEvent} objects at a different times or for events not +handled by the default implementation. The {@link android.view.View} class provides a default +implementation for these event types:</p> + +<ul> + <li>Starting with API Level 4: + <ul> + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CLICKED}</li> + + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_LONG_CLICKED}</li> + + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_FOCUSED}</li> + </ul> + </li> + <li>Starting with API Level 14: + <ul> + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_SCROLLED}</li> + + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_HOVER_ENTER}</li> + + <li>{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_HOVER_EXIT}</li> + </ul> + </li> +</ul> + +<p class="note"><strong>Note:</strong> Hover events are associated with the Explore by +Touch feature, which uses these events as triggers for providing audible prompts for user interface +elements.</p> + +<p>In general, you should send an {@link android.view.accessibility.AccessibilityEvent} whenever the +content of your custom view changes. For example, if you are implementing a custom slider bar that +allows a user to select a numeric value by pressing the left or right arrows, your custom view +should emit an event of type {@link +android.view.accessibility.AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} whenever the slider +value changes. The following sample code demonstrates the use of the {@link +android.view.accessibility.AccessibilityEventSource#sendAccessibilityEvent +sendAccessibilityEvent()} method to report this event.</p> + +<pre> +@Override +public boolean onKeyUp (int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { + mCurrentValue--; + sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED); + return true; + } + ... +} +</pre> + + +<h3 id="populate-events">Populating accessibility events</h3> + +<p>Each {@link android.view.accessibility.AccessibilityEvent} has a set of required properties that +describe the current state of the view. These properties include things such as the view’s class +name, content description and checked state. The specific properties required for each event type +are described in the {@link android.view.accessibility.AccessibilityEvent} reference documentation. +The {@link android.view.View} implementation provides default values for these properties. Many of +these values, including the class name and event timestamp, are provided automatically. If you are +creating a custom view component, you must provide some information about the content and +characteristics of the view. This information may be as simple as a button label, but may also +include additional state information that you want to add to the event.</p> + +<p>The minimum requirement for providing information to accessibility services with a custom +view is to implement {@link android.view.View#dispatchPopulateAccessibilityEvent +dispatchPopulateAccessibilityEvent()}. This method is called by the system to request +information for an {@link android.view.accessibility.AccessibilityEvent} and makes your custom +view compatible with accessibility services on Android 1.6 (API Level 4) and higher. The +following example code demonstrates a basic implementation of this method.</p> + +<pre> +@Override +public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { + super.dispatchPopulateAccessibilityEvent(event); + // Call the super implementation to populate its text to the event, which + // calls onPopulateAccessibilityEvent() on API Level 14 and up. + + // In case this is running on a API revision earlier that 14, check + // the text content of the event and add an appropriate text + // description for this custom view: + CharSequence text = getText(); + if (!TextUtils.isEmpty(text)) { + event.getText().add(text); + } +} +</pre> + +<p>On Android 4.0 (API Level 14) and higher, the {@link +android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()} and +{@link android.view.View#onInitializeAccessibilityEvent onInitializeAccessibilityEvent()} +methods are the recommended way to populate or modify the information in an {@link +android.view.accessibility.AccessibilityEvent}. Use the +{@link android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()} method +specifically for adding or modifying the text content of the event, which is turned into audible +prompts by accessibility services such as TalkBack. Use the +{@link android.view.View#onInitializeAccessibilityEvent onInitializeAccessibilityEvent()} method for +populating additional information about the event, such as the selection state of the view.</p> + +<p>In addition, you should also implement the +{@link android.view.View#onInitializeAccessibilityNodeInfo onInitializeAccessibilityNodeInfo()} +method. {@link android.view.accessibility.AccessibilityNodeInfo} objects populated by this method +are used by accessibility services to investigate the view hierarchy that generated an accessibility +event after receiving that event, to obtain a more detailed context information and provide +appropriate feedback to users.</p> + +<p>The example code below shows how override these three methods by using +{@link android.support.v4.view.ViewCompat#setAccessibilityDelegate +ViewCompat.setAccessibilityDelegate()}. Note that this sample code requires that the Android +<a href="{@docRoot}sdk/compatibility-library.html">Support Library</a> for API Level 4 (revision 5 +or higher) is added to your project.</p> + +<pre> +ViewCompat.setAccessibilityDelegate(new AccessibilityDelegateCompat() { + @Override + public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) { + super.onPopulateAccessibilityEvent(host, event); + // We call the super implementation to populate its text for the + // event. Then we add our text not present in a super class. + // Very often you only need to add the text for the custom view. + CharSequence text = getText(); + if (!TextUtils.isEmpty(text)) { + event.getText().add(text); + } + } + @Override + public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(host, event); + // We call the super implementation to let super classes + // set appropriate event properties. Then we add the new property + // (checked) which is not supported by a super class. + event.setChecked(isChecked()); + } + @Override + public void onInitializeAccessibilityNodeInfo(View host, + AccessibilityNodeInfoCompat info) { + super.onInitializeAccessibilityNodeInfo(host, info); + // We call the super implementation to let super classes set + // appropriate info properties. Then we add our properties + // (checkable and checked) which are not supported by a super class. + info.setCheckable(true); + info.setChecked(isChecked()); + // Quite often you only need to add the text for the custom view. + CharSequence text = getText(); + if (!TextUtils.isEmpty(text)) { + info.setText(text); + } + } +} +</pre> + +<p>On applications targeting Android 4.0 (API Level 14) and higher, these methods can be implemented +directly in your custom view class. For another example of this approach, see the Android +<a href="{@docRoot}sdk/compatibility-library.html">Support Library</a> (revision 5 or higher) sample +{@code AccessibilityDelegateSupportActivity} in +({@code <sdk>/extras/android/support/v4/samples/Support4Demos/}).</p> + +<p class="note"><strong>Note:</strong> You may find information on implementing accessibility for +custom views written prior to Android 4.0 that describes the use of the +{@link android.view.View#dispatchPopulateAccessibilityEvent dispatchPopulateAccessibilityEvent()} +method for populating AccessibilityEvents. As of the Android 4.0 release, however, the recommended +approach is to use the +{@link android.view.View#onPopulateAccessibilityEvent onPopulateAccessibilityEvent()} and +{@link android.view.View#onInitializeAccessibilityEvent onInitializeAccessibilityEvent()} +methods.</p> + + +<h2 id="test">Testing Accessibility</h2> + +<p>Testing the accessibility of your application is an important part of ensuring your users have a +great experience. You can test the most important parts of accessibility by testing your application +with audible feedback enabled and testing navigation within your application using directional +controls.</p> + +<h3 id="test-audibles">Testing audible feedback</h3> +<p>You can simulate the experience for many users by enabling an accessibility service that speaks +as you move around the screen. The Explore by Touch accessibility service, which is available on +devices with Android 4.0 and later. The <a +href="https://play.google.com/store/apps/details?id=com.google.android.marvin.talkback">TalkBack</a> +accessibility service, by the <a href="http://code.google.com/p/eyes-free/">Eyes-Free +Project</a> comes preinstalled on many Android devices.</p> + +<p>To enable TalkBack on revisions of Android prior to Android 4.0:</p> +<ol> + <li>Launch the Settings application.</li> + <li>Navigate to the <strong>Accessibility</strong> category and select it.</li> + <li>Select <strong>Accessibility</strong> to enable it.</li> + <li>Select <strong>TalkBack</strong> to enable it.</li> +</ol> + +<p class="note"><strong>Note:</strong> If the TalkBack accessibility service is not available, you +can install it for free from <a href="http://play.google.com">Google Play</a>.</p> + +<p>To enable Explore by Touch on Android 4.0 and later:</p> +<ol> + <li>Launch the Settings application.</li> + <li>Navigate to the <strong>Accessibility</strong> category and select it.</li> + <li>Select the <strong>TalkBack</strong> to enable it.</li> + <li>Return to the <strong>Accessibility</strong> category and select <strong>Explore by +Touch</strong> to enable it. + <p class="note"><strong>Note:</strong> You must turn on TalkBack <em>first</em>, otherwise this +option is not available.</p> + </li> +</ol> + +<h3 id="test-navigation">Testing focus navigation</h3> + +<p>As part of your accessibility testing, you can test navigation of your application using focus, +even if your test devices does not have a directional controller. The <a +href="{@docRoot}guide/developing/tools/emulator.html">Android Emulator</a> provides a +simulated directional controller that you can easily use to test navigation. You can also use the +arrow keys and Enter key on your keyboard with the Emulator to simulate use of a D-pad.</p> diff --git a/docs/html/guide/topics/ui/accessibility/index.jd b/docs/html/guide/topics/ui/accessibility/index.jd new file mode 100644 index 000000000000..414d5f3ec6e7 --- /dev/null +++ b/docs/html/guide/topics/ui/accessibility/index.jd @@ -0,0 +1,55 @@ +page.title=Accessibility +parent.title=User Interface +parent.link=../index.html +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> + + <h2>Topics</h2> + <ol> + <li><a href="{@docRoot}guide/topics/ui/accessibility/apps.html">Making Applications Accessible</a> + </li> + <li><a href="{@docRoot}guide/topics/ui/accessibility/services.html">Building Accessibility + Services</a></li> + </ol> + + <h2>Key classes</h2> + <ol> + <li>{@link android.view.accessibility.AccessibilityEvent}</li> + <li>{@link android.accessibilityservice.AccessibilityService}</li> + </ol> + + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}training/accessibility/index.html">Implementing Accessibility</a></li> + </ol> + +</div> +</div> + +<p>Many Android users have disabilities that require them to interact with their Android devices in +different ways. These include users who have visual, physical or age-related disabilities that +prevent them from fully seeing or using a touchscreen.</p> + +<p>Android provides accessibility features and services for helping these users navigate their +devices more easily, including text-to-speech, haptic feedback, trackball and D-pad navigation that +augment their experience. Android application developers can take advantage of these services to +make their applications more accessible and also build their own accessibility services.</p> + +<p>The following topics show you how to use the Android framework to make applications more +accessible.</p> + +<dl> + <dt><strong><a href="{@docRoot}guide/topics/ui/accessibility/apps.html">Making Applications +Accessible</a></strong> + </dt> + <dd>Development practices and API features to ensure your application is accessible to users with +disabilities.</dd> + + <dt><strong><a href="{@docRoot}guide/topics/ui/accessibility/service.html">Building Accessibility +Services</a></strong> + </dt> + <dd>How to use API features to build services that make other applications more accessible for +users.</dd> +</dl>
\ No newline at end of file diff --git a/docs/html/guide/topics/ui/accessibility/services.jd b/docs/html/guide/topics/ui/accessibility/services.jd new file mode 100644 index 000000000000..0dad4ec5c851 --- /dev/null +++ b/docs/html/guide/topics/ui/accessibility/services.jd @@ -0,0 +1,290 @@ +page.title=Building Accessibility Services +parent.title=Accessibility +parent.link=index.html +@jd:body + +<div id="qv-wrapper"> +<div id="qv"> + + <h2>Topics</h2> + <ol> + <li><a href="#manifest">Manifest Declarations and Permissions</a> + <ol> + <li><a href="service-declaration">Accessibility service declaration</a></li> + <li><a href="#service-config">Accessibility service configuration</a></li> + </ol> + </li> + <li><a href="#methods">AccessibilityService Methods</a></li> + <li><a href="#event-details">Getting Event Details</a></li> + <li><a href="#examples">Example Code</a></li> + </ol> + + <h2>Key classes</h2> + <ol> + <li>{@link android.accessibilityservice.AccessibilityService}</li> + <li>{@link android.accessibilityservice.AccessibilityServiceInfo}</li> + <li>{@link android.view.accessibility.AccessibilityEvent}</li> + <li>{@link android.view.accessibility.AccessibilityRecord}</li> + <li>{@link android.view.accessibility.AccessibilityNodeInfo}</li> + </ol> + + <h2>See also</h2> + <ol> + <li><a href="{@docRoot}training/accessibility/index.html">Implementing Accessibility</a></li> + </ol> + +</div> +</div> + +<p>An accessibility service is an application that provides user interface enhancements to +assist users with disabilities, or who may temporarily be unable to fully interact with a device. +For example, users who are driving, taking care of a young child or attending a very loud party +might need additional or alternative interface feedback.</p> + +<p>Android provides standard accessibility services, including TalkBack, and developers can +create and distribute their own services. This document explains the basics of building an +accessibility service.</p> + +<p>The ability for you to build and deploy accessibility services was introduced with Android +1.6 (API Level 4) and received significant improvements with Android 4.0 (API Level 14). The Android +Support Library was also updated with the release of Android 4.0 to provide support for these +enhanced accessibility features back to Android 1.6. Developers aiming for widely compatible +accessibility services are encouraged to use the +<a href="{@docRoot}sdk/compatibility-library.html">Support Library</a> and develop for the more +advanced accessibility features introduced in Android 4.0.</p> + + +<h2 id="manifest">Manifest Declarations and Permissions</h2> + +<p>Applications that provide accessibility services must include specific declarations in their + application manifests in order to be treated as an accessibility service by an Android system. + This section explains the required and optional settings for accessibility services.</p> + + +<h3 id="service-declaration">Accessibility service declaration</h3> + +<p>In order to be treated as an accessibility service, your application must include the +{@code service} element (rather than the {@code activity} element) within the {@code application} +element in its manifest. In addition, within the {@code service} element, you must also include an +accessibility service intent filter, as shown in the following sample:</p> + +<pre> +<application> + <service android:name=".MyAccessibilityService" + android:label="@string/accessibility_service_label"> + <intent-filter> + <action android:name="android.accessibilityservice.AccessibilityService" /> + </intent-filter> + </service> +</application> +</pre> + +<p>These declarations are required for all accessibility services deployed on Android 1.6 (API Level + 4) or higher.</p> + + +<h3 id="service-config">Accessibility service configuration</h3> + +<p>Accessibility services must also provide a configuration which specifies the types of +accessibility events that the service handles and additional information about the service. The +configuration of an accessibility service is contained in the {@link +android.accessibilityservice.AccessibilityServiceInfo} class. Your service can build and set a +configuration using an instance of this class and {@link +android.accessibilityservice.AccessibilityService#setServiceInfo setServiceInfo()} at runtime. +However, not all configuration options are available using this method.</p> + +<p>Beginning with Android 4.0, you can include a {@code <meta-data>} element in your manifest +with a reference to a configuration file, which allows you to set the full range of options for +your accessibility service, as shown in the following example:</p> + +<pre> +<service android:name=".MyAccessibilityService"> + ... + <meta-data + android:name="android.accessibilityservice" + android:resource="@xml/accessibility_service_config" /> +</service> +</pre> + +<p>This meta-data element refers to an XML file that you create in your application’s resource +directory ({@code <project_dir>/res/xml/accessibility_service_config.xml}). The following code +shows example contents for the service configuration file:</p> + +<pre> +<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" + android:description="@string/accessibility_service_description" + android:packageNames="com.example.android.apis" + android:accessibilityEventTypes="typeAllMask" + android:accessibilityFlags="flagDefault" + android:accessibilityFeedbackType="feedbackSpoken" + android:notificationTimeout="100" + android:canRetrieveWindowContent="true" + android:settingsActivity="com.example.android.accessibility.ServiceSettingsActivity" +/> +</pre> + +<p>One of the most important functions of the accessibility service configuration parameters is to +allow you to specify what types of accessibility events your service can handle. Being able to +specify this information enables accessibility services to cooperate with each other, and allows you +as a developer the flexibility to handle only specific events types from specific applications. The +event filtering can include the following criteria:</p> + +<ul> + <li><strong>Package Names</strong> - Specify the package names of applications whose accessibility +events you want your service to handle. If this parameter is omitted, your accessibility service is +considered available to service accessibility events for any application. This parameter can be set +in the accessibility service configuration files with the {@code android:packageNames} attribute as +a comma-separated list, or set using the {@link +android.accessibilityservice.AccessibilityServiceInfo#packageNames +AccessibilityServiceInfo.packageNames} member.</li> + <li><strong>Event Types</strong> - Specify the types of accessibility events you want your service +to handle. This parameter can be set in the accessibility service configuration files with the +{@code android:accessibilityEventTypes} attribute as a comma-separated list, or set using the +{@link android.accessibilityservice.AccessibilityServiceInfo#eventTypes +AccessibilityServiceInfo.eventTypes} member. </li> +</ul> + +<p>For more information about the XML attributes which can be used in the accessibility service + configuration file, follow these links to the reference documentation:</p> + +<ul> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_description">{@code android:description}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_packageNames">{@code android:packageNames}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_accessibilityEventTypes">{@code android:accessibilityEventTypes}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_accessibilityFlags">{@code android:accessibilityFlags}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_accessibilityFeedbackType">{@code android:accessibilityFeedbackType}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_notificationTimeout">{@code android:notificationTimeout}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_canRetrieveWindowContent">{@code android:canRetrieveWindowContent}</a></li> + <li><a href="{@docRoot}reference/android/R.styleable.html#AccessibilityService_settingsActivity">{@code android:settingsActivity}</a></li> +</ul> + +<p>For more information about which configuration settings can be dynamically set at runtime, see +the {@link android.accessibilityservice.AccessibilityServiceInfo} reference documentation.</p> + + +<h2 id="methods">AccessibilityService Methods</h2> + +<p>An application that provides accessibility service must extend the {@link +android.accessibilityservice.AccessibilityService} class and override the following methods from +that class. These methods are presented in the order in which they are called by the Android system, +from when the service is started +({@link android.accessibilityservice.AccessibilityService#onServiceConnected onServiceConnected()}), +while it is running ({@link android.accessibilityservice.AccessibilityService#onAccessibilityEvent +onAccessibilityEvent()}, +{@link android.accessibilityservice.AccessibilityService#onInterrupt onInterrupt()}) to when it is +shut down ({@link android.accessibilityservice.AccessibilityService#onUnbind onUnbind()}).</p> + +<ul> + <li>{@link android.accessibilityservice.AccessibilityService#onServiceConnected +onServiceConnected()} - (optional) This system calls this method when it successfully connects to +your accessibility service. Use this method to do any one-time setup steps for your service, +including connecting to user feedback system services, such as the audio manager or device vibrator. +If you want to set the configuration of your service at runtime or make one-time adjustments, this +is a convenient location from which to call {@link +android.accessibilityservice.AccessibilityService#setServiceInfo setServiceInfo()}.</li> + + <li>{@link android.accessibilityservice.AccessibilityService#onAccessibilityEvent +onAccessibilityEvent()} - (required) This method is called back by the system when it detects an +{@link android.view.accessibility.AccessibilityEvent} that matches the event filtering parameters +specified by your accessibility service. For example, when the user clicks a button or focuses on a +user interface control in an application for which your accessibility service is providing feedback. +When this happens, the system calls this method of your service with the associated {@link +android.view.accessibility.AccessibilityEvent}, which you can then interpret and provide feedback to +the user. This method may be called many times over the lifecycle of your service.</li> + + <li>{@link android.accessibilityservice.AccessibilityService#onInterrupt onInterrupt()} - +(required) This method is called when the system wants to interrupt the feedback your service is +providing, usually in response to a user taking action, such as moving focus to a different user +interface control than the one for which you are currently providing feedback. This method may be +called many times over the lifecycle of your service.</li> + + <li>{@link android.accessibilityservice.AccessibilityService#onUnbind onUnbind()} - (optional) +This method is called when the system is about to shutdown the accessibility service. Use this +method to do any one-time shutdown procedures, including de-allocating user feedback system +services, such as the audio manager or device vibrator.</li> +</ul> + +<p>These callback methods provide the basic structure for your accessibility service. It is up to +you to decide on how to process data provided by the Android system in the form of {@link +android.view.accessibility.AccessibilityEvent} objects and provide feedback to the user.</p> + + +<h2 id="event-details">Getting Event Details</h2> + +<p>The Android system provides information to accessibility services about the user interface +interaction through {@link android.view.accessibility.AccessibilityEvent} objects. Prior to Android +4.0, the information available in an accessibility event, while providing a significant amount of +detail about a user interface control selected by the user, typically provided limited contextual +information. In many cases, this missing context information might be critical to understanding the +meaning of the selected control.</p> + +<p>A typical example of an interface where context is of critical importance is a calendar or day +planner. If a user selects a 4:00 PM time slot in a Monday to Friday day list and the accessibility +service announces “4 PM”, but fails to indicate this is a Friday a Monday, the month or day, this is +hardly ideal feedback for the user. In this case, the context of a user interface control is of +critical importance to a user who wants to schedule a meeting.</p> + +<p>Android 4.0 significantly extends the amount of information that an accessibility service can +obtain about an user interface interaction by composing accessibility events based on the view +hierarchy. A view hierarchy is the set of user interface components that contain the component (its +parents) and the user interface elements that may be contained by that component (its children). In +this way, the Android system can provide much richer detail about accessibility events, allowing +accessibility services to provide more useful feedback to users.</p> + +<p>An accessibility service gets information about an user interface event through an {@link +android.view.accessibility.AccessibilityEvent} passed by the system to the service’s +{@link android.accessibilityservice.AccessibilityService#onAccessibilityEvent +onAccessibilityEvent()} callback method. This object provides details about the event, including the +type of object being acted upon, its descriptive text and other details. Starting in Android 4.0 +(and supported in previous releases through the {@link +android.support.v4.view.accessibility.AccessibilityEventCompat} object in the Support Library), you +can obtain additional information about the event using these calls:</p> + +<ul> + <li>{@link android.view.accessibility.AccessibilityEvent#getRecordCount +AccessibilityEvent.getRecordCount()} and {@link +android.view.accessibility.AccessibilityEvent#getRecord getRecord(int)} - These methods allow you to +retrieve the set of {@link android.view.accessibility.AccessibilityRecord} objects which contributed +to the {@link android.view.accessibility.AccessibilityEvent} passed to you by the system, which can +provide more context for your accessibility service.</li> + + <li>{@link android.view.accessibility.AccessibilityEvent#getSource +AccessibilityEvent.getSource()} - This method returns an {@link +android.view.accessibility.AccessibilityNodeInfo} object. This object allows you to request the +parents and children of the component that originated the accessibility event and investigate their +contents and state in order to provide + + <p class="caution"><strong>Important:</strong> The ability to investigate the full view +hierarchy from an {@link android.view.accessibility.AccessibilityEvent} potentially exposes private +user information to your accessibility service. For this reason, your service must request this +level of access through the accessibility <a href="#service-config">service configuration XML</a> +file, by including the {@code canRetrieveWindowContent} attribute and setting it to {@code true}. If +you do not include this setting in your service configuration xml file, calls to {@link +android.view.accessibility.AccessibilityEvent#getSource getSource()} fail.</p> + </li> +</ul> + + +<h2 id="examples">Example Code</h2> + +<p>The API Demo project contains two samples which can be used as a starting point for generating +accessibility services +({@code <sdk>/samples/<platform>/ApiDemos/src/com/example/android/apis/accessibility}): +</p> + +<ul> + <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackService.html">ClockBackService</a> + - This service is based on the original implementation of {@link +android.accessibilityservice.AccessibilityService} and can be used as a base for developing basic +accessibility services that are compatible with Android 1.6 (API Level 4) and higher.</li> + <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.html">TaskBackService</a> + - This service is based on the enhanced accessibility APIs introduced in Android 4.0 (API Level +14). However, you can use the Android <a href="{@docRoot}sdk/compatibility-library.html">Support +Libary</a> to substitute classes introduced in later API levels (e.g., +{@link android.view.accessibility.AccessibilityRecord}, +{@link android.view.accessibility.AccessibilityNodeInfo} +) with equivalent support package classes (e.g., +{@link android.support.v4.view.accessibility.AccessibilityRecordCompat}, +{@link android.support.v4.view.accessibility.AccessibilityNodeInfoCompat} +) to make this example work with API versions back to Android 1.6 (API Level 4).</li> +</ul> diff --git a/docs/html/guide/tutorials/views/hello-mapview.jd b/docs/html/guide/tutorials/views/hello-mapview.jd index 458db4ff0e08..5217b6b20e9f 100644 --- a/docs/html/guide/tutorials/views/hello-mapview.jd +++ b/docs/html/guide/tutorials/views/hello-mapview.jd @@ -14,8 +14,8 @@ location:</p> href="http://code.google.com/android/add-ons/google-apis">http://code.google.com/android/add-ons/google-apis</a></p> <p>The Google APIs add-on requires Android 1.5 SDK or later release. After -installing the add-on in your SDK, set your project properties to use the build -target called "Google APIs Add-on". See the instructions for setting a build +installing the add-on in your SDK, set your project properties to use a <strong>Google +APIs</strong> build target. See the instructions for setting a build target in <a href="{@docRoot}guide/developing/eclipse-adt.html">Developing in Eclipse with ADT</a> or <a href="{@docRoot}guide/developing/other-ide.html">Developing in Other IDEs</a>, diff --git a/docs/html/images/screens_support/avds-config.png b/docs/html/images/screens_support/avds-config.png Binary files differindex 3af1c395a133..c7d534cdd463 100644 --- a/docs/html/images/screens_support/avds-config.png +++ b/docs/html/images/screens_support/avds-config.png diff --git a/docs/html/index.jd b/docs/html/index.jd index 787a655e5de4..d3203bbb04cb 100644 --- a/docs/html/index.jd +++ b/docs/html/index.jd @@ -53,28 +53,32 @@ Android apps!</p> <p><a href="{@docRoot}sdk/index.html">Learn more »</a></p> </td> </tr> + + <tr> <td colspan="2"><div class="seperator"> </div></td> </tr> <tr> - <td class="imageCell"><a href="http://play.google.com/apps/publish"><img src="{@docRoot}assets/images/icon_play.png" style="padding:0" /></a></td> + <td class="imageCell"><a href="{@docRoot}design/index.html"><img src="{@docRoot}assets/images/icon_design.png" style="padding:5px" /></a></td> <td> - <h2 class="green">Publish</h2> - <p>Google Play is an open service that lets you distribute your apps to devices.</p> - <p><a href="http://play.google.com/apps/publish">Learn more »</a></p> + <h2 class="green">Design</h2> + <p>Learn about principles, building blocks, and patterns for creating world-class Android user interfaces.</p> + <p><a href="{@docRoot}design/index.html">Learn more »</a></p> </td> </tr> + <tr> <td colspan="2"><div class="seperator"> </div></td> </tr> <tr> - <td class="imageCell"><a href="http://source.android.com"><img src="{@docRoot}assets/images/icon_contribute.jpg" style="padding:0" /></a></td> + <td class="imageCell"><a href="http://play.google.com/apps/publish"><img src="{@docRoot}assets/images/icon_play.png" style="padding:0" /></a></td> <td> - <h2 class="green">Contribute</h2> - <p>Android Open Source Project gives you access to the entire platform source.</p> - <p><a href="http://source.android.com">Learn more »</a></p> + <h2 class="green">Publish</h2> + <p>Google Play is an open service that lets you distribute your apps to devices.</p> + <p><a href="http://play.google.com/apps/publish">Learn more »</a></p> </td> </tr> + <tr> <td colspan="2"><div class="seperator"> </div></td> </tr> diff --git a/docs/html/offline.jd b/docs/html/offline.jd index 5f8e37ce91ad..edd8eb09dd2d 100644 --- a/docs/html/offline.jd +++ b/docs/html/offline.jd @@ -40,7 +40,7 @@ tools</li> <p>Follow the guide to <a href="{@docRoot}sdk/installing.html">Installing the Android SDK</a>, which will help you setup your development environment.</p> -<h3>If you've installed new SDK components using the SDK and AVD Manager</h3> +<h3>If you've installed new SDK components using the Android SDK Manager</h3> <p>There's no additional setup.</p> diff --git a/docs/html/resources/articles/images/spellcheck_client_flow.png b/docs/html/resources/articles/images/spellcheck_client_flow.png Binary files differnew file mode 100644 index 000000000000..4e097aa13533 --- /dev/null +++ b/docs/html/resources/articles/images/spellcheck_client_flow.png diff --git a/docs/html/resources/articles/images/spellcheck_lifecycle.png b/docs/html/resources/articles/images/spellcheck_lifecycle.png Binary files differnew file mode 100644 index 000000000000..0b1082439f72 --- /dev/null +++ b/docs/html/resources/articles/images/spellcheck_lifecycle.png diff --git a/docs/html/resources/articles/images/textview_spellcheck_screenshot_1.png b/docs/html/resources/articles/images/textview_spellcheck_screenshot_1.png Binary files differnew file mode 100644 index 000000000000..deb47c4fdf37 --- /dev/null +++ b/docs/html/resources/articles/images/textview_spellcheck_screenshot_1.png diff --git a/docs/html/resources/articles/images/textview_spellcheck_screenshot_2.png b/docs/html/resources/articles/images/textview_spellcheck_screenshot_2.png Binary files differnew file mode 100644 index 000000000000..e3af4c5e9f82 --- /dev/null +++ b/docs/html/resources/articles/images/textview_spellcheck_screenshot_2.png diff --git a/docs/html/resources/articles/index.jd b/docs/html/resources/articles/index.jd index 220a4ed2cf0a..2947e4a2649a 100644 --- a/docs/html/resources/articles/index.jd +++ b/docs/html/resources/articles/index.jd @@ -47,7 +47,16 @@ parent.link=../browser.html?tag=article <dt><a href="{@docRoot}resources/articles/glsurfaceview.html">Introducing GLSurfaceView</a></dt> <dd>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.</dd> </dl> - +<dl> + <dt> + <a href="{@docRoot}resources/articles/spell-checker-framework.jd"> + Using the Spell Checker Framework</a> + </dt> + <dd> + This article describes how to use the Spell Checker Framework to check spelling in + various ways in your application. + </dd> +</dl> <dl> <dt><a href="{@docRoot}resources/articles/layout-tricks-reuse.html">Layout Tricks: Creating Reusable UI Components</a></dt> <dd>Learn how to combine multiple standard UI widgets into a single high-level component, which can be reused throughout your application.</dd> @@ -149,7 +158,7 @@ parent.link=../browser.html?tag=article </dl> <dl> - <dt><a href="{@docRoot}resources/articles/window-bg-speed.html">Window Backgrounds & UI Speed</a></dt> + <dt><a href="{@docRoot}resources/articles/window-bg-speed.html">Window Backgrounds & UI Speed</a></dt> <dd>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.</dd> </dl> diff --git a/docs/html/resources/articles/spell-checker-framework.jd b/docs/html/resources/articles/spell-checker-framework.jd new file mode 100644 index 000000000000..8d57b4eb09cd --- /dev/null +++ b/docs/html/resources/articles/spell-checker-framework.jd @@ -0,0 +1,236 @@ +page.title=Using the Spell Checker Framework +parent.title=Articles +parent.link=../browser.html?tag=article +@jd:body +<div id="qv-wrapper"> +<div id="qv"> +<h2>In This Document</h2> +<ol> + <li> + <a href="#SpellCheckLifeCycle">Spell Check Lifecycle</a> + </li> + <li> + <a href="#SpellCheckImplementation">Implementing a Spell Checker Service</a> + </li> + <li> + <a href="#SpellCheckClient">Implementing a Spell Checker Client</a> + </li> +</ol> + <h2>See also</h2> + <ol> + <li> + <a href="{@docRoot}resources/samples/SpellChecker/SampleSpellCheckerService/index.html"> + Spell Checker Service</a> sample app + </li> + <li> + <a href="{@docRoot}resources/samples/SpellChecker/HelloSpellChecker/index.html"> + Spell Checker Client</a> sample app + </li> + </ol> +</div> +</div> + +<p> + The Android platform offers a spell checker framework that lets you implement + and access spell checking in your application. The framework is one of the + Text Service APIs offered by the Android platform. +</p> +<p> + To use the framework in your app, you create a special type of Android service that + generates a spell checker <strong>session</strong> object. Based on text you provide, + the session object returns spelling suggestions generated by the spell checker. +</p> +<h2 id="SpellCheckLifeCycle">Spell Checker Lifecycle</h2> +<p> + The following diagram shows the lifecycle of the spell checker service: +</p> +<img src="{@docRoot}resources/articles/images/spellcheck_lifecycle.png" alt="" height="596" + id="figure1" /> +<p class="img-caption"> + <strong>Figure 1.</strong> The spell checker service lifecycle. +</p> +<p> + To initiate spell checking, your app starts its implementation of the spell checker + service. Clients in your app, such as activities or individual UI elements, request a + spell checker session from the service, then use the session to get suggestions for text. + As a client terminates its operation, it closes its spell checker session. If necessary, your + app can shut down the spell checker service at any time. +</p> +<h2 id="SpellCheckImplementation">Implementing a Spell Checker Service</h2> +<p> + To use the spell checker framework in your app, add a spell checker service component including + the session object definition. You can also add to your app an optional activity that + controls settings. You must also add an XML metadata file that describes + the spell checker service, and add the appropriate elements to your manifest file. +</p> +<h3 id="SpellCheckCode">Spell checker classes</h3> +<p> + Define the service and session object with the following classes: +</p> +<dl> + <dt> + A subclass of {@link android.service.textservice.SpellCheckerService} + </dt> + <dd> + The {@link android.service.textservice.SpellCheckerService} implements both the + {@link android.app.Service} class and the spell checker framework interface. Within your + subclass, you must implement the following method: + <dl> + <dt>{@link android.service.textservice.SpellCheckerService#createSession()}</dt> + <dd> + A factory method that returns a + {@link android.service.textservice.SpellCheckerService.Session} object to a + client that wants to do spell checking. + </dd> + </dl> + <p> + See the + <a href="{@docRoot}resources/samples/SpellChecker/SampleSpellCheckerService/index.html"> + Spell Checker Service</a> sample app to learn more about implementing this class. + </p> + </dd> + <dt> + An implementation of {@link android.service.textservice.SpellCheckerService.Session} + </dt> + <dd> + An object that the spell checker service provides to clients, to let them pass text to + the spell checker and receive suggestions. Within this class, you must implement the + following methods: + <dl> + <dt> + {@link android.service.textservice.SpellCheckerService.Session#onCreate()} + </dt> + <dd> + Called by the system in response to + {@link android.service.textservice.SpellCheckerService#createSession()}. In this + method, you can initialize the + {@link android.service.textservice.SpellCheckerService.Session} object based on + the current locale and so forth. + </dd> + <dt> + {@link android.service.textservice.SpellCheckerService.Session#onGetSuggestions(TextInfo, int) + onGetSuggestions()} + </dt> + <dd> + Does the actual spell checking. This method returns an object containing + suggestions for the text passed to it. + </dd> + </dl> + <p> + Optionally, you can implement + {@link android.service.textservice.SpellCheckerService.Session#onCancel()}, which + handles requests to cancel spell checking, or +{@link android.service.textservice.SpellCheckerService.Session#onGetSuggestionsMultiple(TextInfo[], int, boolean) +onGetSuggestionsMultiple()}, which handles batches of suggestion requests, or both. + </p> + <p> + See the + <a href="{@docRoot}resources/samples/SpellChecker/HelloSpellChecker/index.html"> + Spell Checker Client</a> sample app to learn more about implementing this class. + </p> + </dd> +</dl> +<p class="note"> + <strong>Note:</strong> You must implement all aspects of spell checking as asynchronous and + thread-safe. A spell checker may be called simultaneously by different threads running on + different cores. The {@link android.service.textservice.SpellCheckerService} and + {@link android.service.textservice.SpellCheckerService.Session} take care of this + automatically. +</p> +<h3 id="SpellCheckXML">Spell checker manifest and metadata</h3> +<p> + In addition to code, you need to provide the appropriate manifest file and a metadata file for + the spell checker. +</p> +<p> + The manifest file defines the application, the service, and the activity for controlling + settings, as shown in the following snippet: +</p> +<pre> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.samplespellcheckerservice" > + <application + android:label="@string/app_name" > + <service + android:label="@string/app_name" + android:name=".SampleSpellCheckerService" + android:permission="android.permission.BIND_TEXT_SERVICE" > + <intent-filter > + <action android:name="android.service.textservice.SpellCheckerService" /> + </intent-filter> + + <meta-data + android:name="android.view.textservice.scs" + android:resource="@xml/spellchecker" /> + </service> + + <activity + android:label="@string/sample_settings" + android:name="SpellCheckerSettingsActivity" > + <intent-filter > + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + </application> +</manifest> +</pre> +<p> + Notice that components that want to use the service must request the permission + {@link android.Manifest.permission#BIND_TEXT_SERVICE} to ensure that only the system binds to + the service. The service's definition also specifies the <code>spellchecker.xml</code> metadata + file, which is described in the next section. +</p> +<p> + The metadata file <code>spellchecker.xml</code> contains the following XML: +</p> +<pre> +<spell-checker xmlns:android="http://schemas.android.com/apk/res/android" + android:label="@string/spellchecker_name" + android:settingsActivity="com.example.SpellCheckerSettingsActivity"> + <subtype + android:label="@string/subtype_generic" + android:subtypeLocale="en” + /> + <subtype + android:label="@string/subtype_generic" + android:subtypeLocale="fr” + /> +</spell-checker> +</pre> +<p> + The metadata specifies the activity that the spell checker uses for controlling settings. It + also defines subtypes for the spell checker; in this case, the subtypes define locales that + the spell checker can handle. +</p> + + +<!-- Accessing the Spell Checker Service from a Client --> +<h2 id="SpellCheckClient">Accessing the Spell Checker Service from a Client</h2> +<p> + Applications that use {@link android.widget.TextView} views automatically benefit from spell + checking, because {@link android.widget.TextView} automatically uses a spell checker. The + following screenshots show this: +</p> +<img src="{@docRoot}resources/articles/images/textview_spellcheck_screenshot_1.png" alt="" + height="45" id="figure2a" /> +<br> +<img src="{@docRoot}resources/articles/images/textview_spellcheck_screenshot_2.png" alt="" + height="121" id="figure2b" /> +<p class="img-caption"> + <strong>Figure 2.</strong> Spell checking in TextView. +</p> +<p> + However, you may want to interact directly with a spell checker service in other cases as well. + The following diagram shows the flow of control for interacting with a spell checker service: +</p> +<img src="{@docRoot}resources/articles/images/spellcheck_client_flow.png" alt="" + height="394" id="figure3" /> +<p class="img-caption"> + <strong>Figure 3.</strong> Interacting with a spell checker service. +</p> +<p> + The <a href="{@docRoot}resources/samples/SpellChecker/HelloSpellChecker/index.html"> + Spell Checker Client</a> sample app shows how to interact with a spell checker service. The + LatinIME input method editor in the Android Open Source Project also contains an example of + spell checking. +</p>
\ No newline at end of file diff --git a/docs/html/resources/dashboard/opengl.jd b/docs/html/resources/dashboard/opengl.jd index b1c32343a8d9..4c55522b743d 100644 --- a/docs/html/resources/dashboard/opengl.jd +++ b/docs/html/resources/dashboard/opengl.jd @@ -57,7 +57,7 @@ ending on the data collection date noted below.</p> <div class="dashboard-panel"> <img alt="" width="400" height="250" -src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=GL%201.1%20only|GL%202.0%20%26%201.1&chd=t%3A10.8,89.2" /> +src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=GL%201.1%20only|GL%202.0%20%26%201.1&chd=t%3A11.9,88.1" /> <table> <tr> @@ -66,14 +66,14 @@ src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl= </tr> <tr> <td>1.1 only</th> -<td>10.8%</td> +<td>11.9%</td> </tr> <tr> <td>2.0 & 1.1</th> -<td>89.2%</td> +<td>88.1%</td> </tr> </table> -<p><em>Data collected during a 7-day period ending on March 4, 2012</em></p> +<p><em>Data collected during a 7-day period ending on April 2, 2012</em></p> </div> diff --git a/docs/html/resources/dashboard/platform-versions.jd b/docs/html/resources/dashboard/platform-versions.jd index 65a55751a9fc..2cbbe99dce63 100644 --- a/docs/html/resources/dashboard/platform-versions.jd +++ b/docs/html/resources/dashboard/platform-versions.jd @@ -52,7 +52,7 @@ Google Play within a 14-day period ending on the data collection date noted belo <div class="dashboard-panel"> <img alt="" height="250" width="470" -src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:0.4,0.8,6.6,25.2,0.5,61.4,0.1,1.1,2.1,0.4,1.2&chl=Android%201.5|Android%201.6|Android%202.1|Android%202.2|Android%202.3|Android%202.3.3|Android%203.0|Android%203.1|Android%203.2|Android%204.0|Android%204.0.3&chco=c4df9b,6fad0c" /> +src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:0.3,0.7,6.0,23.1,0.5,63.2,0.1,1.0,2.2,0.5,2.4&chl=Android%201.5|Android%201.6|Android%202.1|Android%202.2|Android%202.3|Android%202.3.3|Android%203.0|Android%203.1|Android%203.2|Android%204.0|Android%204.0.3&chco=c4df9b,6fad0c" /> <table> <tr> @@ -61,25 +61,25 @@ src="http://chart.apis.google.com/chart?&cht=p&chs=460x250&chd=t:0.4,0.8,6.6,25. <th>API Level</th> <th>Distribution</th> </tr> -<tr><td><a href="{@docRoot}sdk/android-1.5.html">Android 1.5</a></td><td>Cupcake</td> <td>3</td><td>0.4%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-1.6.html">Android 1.6</a></td><td>Donut</td> <td>4</td><td>0.8%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-2.1.html">Android 2.1</a></td><td>Eclair</td> <td>7</td><td>6.6%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-2.2.html">Android 2.2</a></td><td>Froyo</td> <td>8</td><td>25.3%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-1.5.html">Android 1.5</a></td><td>Cupcake</td> <td>3</td><td>0.3%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-1.6.html">Android 1.6</a></td><td>Donut</td> <td>4</td><td>0.7%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-2.1.html">Android 2.1</a></td><td>Eclair</td> <td>7</td><td>6.0%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-2.2.html">Android 2.2</a></td><td>Froyo</td> <td>8</td><td>23.1%</td></tr> <tr><td><a href="{@docRoot}sdk/android-2.3.html">Android 2.3 -<br/> Android 2.3.2</a></td><td rowspan="2">Gingerbread</td> <td>9</td><td>0.5%</td></tr> <tr><td><a href="{@docRoot}sdk/android-2.3.3.html">Android 2.3.3 -<br/> - Android 2.3.7</a></td><!-- Gingerbread --> <td>10</td><td>61.5%</td></tr> + Android 2.3.7</a></td><!-- Gingerbread --> <td>10</td><td>63.2%</td></tr> <tr><td><a href="{@docRoot}sdk/android-3.0.html">Android 3.0</a></td> <td rowspan="3">Honeycomb</td> <td>11</td><td>0.1%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-3.1.html">Android 3.1</a></td><!-- Honeycomb --><td>12</td><td>1.1%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-3.2.html">Android 3.2</a></td><!-- Honeycomb --><td>13</td><td>2.1%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-3.1.html">Android 3.1</a></td><!-- Honeycomb --><td>12</td><td>1.0%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-3.2.html">Android 3.2</a></td><!-- Honeycomb --><td>13</td><td>2.2%</td></tr> <tr><td><a href="{@docRoot}sdk/android-4.0.html">Android 4.0 -<br/> Android 4.0.2</a></td> - <td rowspan="2">Ice Cream Sandwich</td><td>14</td><td>0.4%</td></tr> -<tr><td><a href="{@docRoot}sdk/android-4.0.3.html">Android 4.0.3</a></td><!-- ICS --><td>15</td><td>1.2%</td></tr> + <td rowspan="2">Ice Cream Sandwich</td><td>14</td><td>0.5%</td></tr> +<tr><td><a href="{@docRoot}sdk/android-4.0.3.html">Android 4.0.3</a></td><!-- ICS --><td>15</td><td>2.4%</td></tr> </table> -<p><em>Data collected during a 14-day period ending on March 5, 2012</em></p> +<p><em>Data collected during a 14-day period ending on April 2, 2012</em></p> <!-- <p style="font-size:.9em">* <em>Other: 0.1% of devices running obsolete versions</em></p> --> @@ -108,9 +108,9 @@ Google Play within a 14-day period ending on the date indicated on the x-axis.</ <div class="dashboard-panel"> <img alt="" height="250" width="660" style="padding:5px;background:#fff" -src="http://chart.apis.google.com/chart?&cht=lc&chs=660x250&chxt=x,x,y,r&chxr=0,0,12|1,0,12|2,0,100|3,0,100&chxl=0%3A%7C09/01%7C09/15%7C10/01%7C10/15%7C11/01%7C11/15%7C12/01%7C12/15%7C01/01%7C01/15%7C02/01%7C02/15%7C03/01%7C1%3A%7C2011%7C%7C%7C%7C%7C%7C%7C%7C2012%7C%7C%7C%7C2012%7C2%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25%7C3%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25&chxp=0,0,1,2,3,4,5,6,7,8,9,10,11,12&chxtc=0,5&chd=t:97.9,97.9,97.7,97.6,97.5,99.4,99.4,99.2,98.9,98.8,99.2,98.9,98.9|96.9,96.9,96.6,96.6,96.5,98.6,98.6,98.5,98.3,98.2,98.6,98.4,98.4|95.1,95.2,95.1,95.4,95.2,97.2,97.3,97.3,97.2,97.2,97.6,97.5,97.6|81.8,82.7,83.3,84.4,84.6,87.0,87.7,88.1,88.7,89.2,89.9,90.3,90.8|30.6,34.1,37.8,40.8,43.5,48.4,52.4,55.2,58.2,60.1,62.0,63.7,65.2|0.0,0.0,0.0,0.0,0.0,2.0,2.3,2.6,3.5,3.6,4.0,4.1,4.3|0.0,0.0,0.0,0.0,0.0,1.0,1.2,1.3,2.0,2.2,2.6,3.0,3.2|0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.3,0.4,0.7,0.8,1.1&chm=b,c3df9b,0,1,0|b,b8dc82,1,2,0|tAndroid%202.1,608920,2,0,15,,t::-5|b,addb67,2,3,0|tAndroid%202.2,517617,3,0,15,,t::-5|b,a3db4b,3,4,0|tAndroid%202.3.3,426210,4,0,15,,t::-5|b,98dc2e,4,5,0|b,8cd41b,5,6,0|b,7ec113,6,7,0|B,6fad0c,7,8,0&chg=7,25&chdl=Android%201.5|Android%201.6|Android%202.1|Android%202.2|Android%202.3.3|Android%203.1|Android%203.2|Android%204.0.3&chco=add274,a2d15a,97d13e,8bcb28,7dba1e,6ea715,5f920e,507d08" /> +src="http://chart.apis.google.com/chart?&cht=lc&chs=660x250&chxt=x,x,y,r&chxr=0,0,12|1,0,12|2,0,100|3,0,100&chxl=0%3A%7C10/01%7C10/15%7C11/01%7C11/15%7C12/01%7C12/15%7C01/01%7C01/15%7C02/01%7C02/15%7C03/01%7C03/15%7C04/01%7C1%3A%7C2011%7C%7C%7C%7C%7C%7C2012%7C%7C%7C%7C%7C%7C2012%7C2%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25%7C3%3A%7C0%25%7C25%25%7C50%25%7C75%25%7C100%25&chxp=0,0,1,2,3,4,5,6,7,8,9,10,11,12&chxtc=0,5&chd=t:97.7,97.6,97.5,99.4,99.4,99.2,98.9,98.8,99.2,98.9,98.9,99.0,98.8|96.6,96.6,96.5,98.6,98.6,98.5,98.3,98.2,98.6,98.4,98.4,98.6,98.5|95.1,95.4,95.2,97.2,97.3,97.3,97.2,97.2,97.6,97.5,97.6,97.8,97.8|83.3,84.4,84.6,87.0,87.7,88.1,88.7,89.2,89.9,90.3,90.8,91.4,91.8|37.8,40.8,43.5,48.4,52.4,55.2,58.2,60.1,62.0,63.7,65.2,66.8,68.6|0.0,0.0,0.0,2.0,2.3,2.6,3.5,3.6,4.0,4.1,4.3,4.6,5.5|0.0,0.0,0.0,1.0,1.2,1.3,2.0,2.2,2.6,3.0,3.2,3.5,4.5|0.0,0.0,0.0,0.0,0.0,0.0,0.3,0.4,0.7,0.8,1.1,1.3,2.3&chm=b,c3df9b,0,1,0|b,b8dc82,1,2,0|tAndroid%202.1,608920,2,0,15,,t::-5|b,addb67,2,3,0|tAndroid%202.2,517617,3,0,15,,t::-5|b,a3db4b,3,4,0|tAndroid%202.3.3,426210,4,0,15,,t::-5|b,98dc2e,4,5,0|b,8cd41b,5,6,0|b,7ec113,6,7,0|B,6fad0c,7,8,0&chg=7,25&chdl=Android%201.5|Android%201.6|Android%202.1|Android%202.2|Android%202.3.3|Android%203.1|Android%203.2|Android%204.0.3&chco=add274,a2d15a,97d13e,8bcb28,7dba1e,6ea715,5f920e,507d08" /> -<p><em>Last historical dataset collected during a 14-day period ending on March 5, 2012</em></p> +<p><em>Last historical dataset collected during a 14-day period ending on April 2, 2012</em></p> </div><!-- end dashboard-panel --> diff --git a/docs/html/resources/dashboard/screens.jd b/docs/html/resources/dashboard/screens.jd index e9c738e0e4b2..e5c79a125d33 100644 --- a/docs/html/resources/dashboard/screens.jd +++ b/docs/html/resources/dashboard/screens.jd @@ -60,7 +60,7 @@ ending on the data collection date noted below.</p> <div class="dashboard-panel"> <img alt="" width="400" height="250" -src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=Xlarge%20/%20mdpi|Large%20/%20ldpi|Large%20/%20mdpi|Normal%20/%20hdpi|Normal%20/%20ldpi|Normal%20/%20mdpi|Normal%20/%20xhdpi|Small%20/%20hdpi|Small%20/%20ldpi&chd=t%3A4.9,0.2,2.8,66.4,0.7,18.5,2.5,2.4,1.7" /> +src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=Xlarge%20/%20mdpi|Large%20/%20ldpi|Large%20/%20mdpi|Normal%20/%20hdpi|Normal%20/%20ldpi|Normal%20/%20mdpi|Normal%20/%20xhdpi|Small%20/%20hdpi|Small%20/%20ldpi&chd=t%3A5.8,0.2,2.3,64.6,0.7,19.6,2.4,2.5,1.9" /> <table> <tr> @@ -71,31 +71,31 @@ src="http://chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl= <th scope="col">xhdpi</th> </tr> <tr><th scope="row">small</th> -<td>1.7%</td> <!-- small/ldpi --> +<td>1.9%</td> <!-- small/ldpi --> <td></td> <!-- small/mdpi --> -<td>2.4%</td> <!-- small/hdpi --> +<td>2.5%</td> <!-- small/hdpi --> <td></td> <!-- small/xhdpi --> </tr> <tr><th scope="row">normal</th> <td>0.7%</td> <!-- normal/ldpi --> -<td>18.5%</td> <!-- normal/mdpi --> -<td>66.3%</td> <!-- normal/hdpi --> -<td>2.5%</td> <!-- normal/xhdpi --> +<td>19.6%</td> <!-- normal/mdpi --> +<td>64.6%</td> <!-- normal/hdpi --> +<td>2.4%</td> <!-- normal/xhdpi --> </tr> <tr><th scope="row">large</th> <td>0.2%</td> <!-- large/ldpi --> -<td>2.8%</td> <!-- large/mdpi --> +<td>2.3%</td> <!-- large/mdpi --> <td></td> <!-- large/hdpi --> <td></td> <!-- large/xhdpi --> </tr> <tr><th scope="row">xlarge</th> <td></td> <!-- xlarge/ldpi --> -<td>4.9%</td> <!-- xlarge/mdpi --> +<td>5.8%</td> <!-- xlarge/mdpi --> <td></td> <!-- xlarge/hdpi --> <td></td> <!-- xlarge/xhdpi --> </tr> </table> -<p><em>Data collected during a 7-day period ending on March 4, 2012</em></p> +<p><em>Data collected during a 7-day period ending on April 2, 2012</em></p> </div> diff --git a/docs/html/resources/resources-data.js b/docs/html/resources/resources-data.js index 8ad970ba7c45..fb4225dc8a2d 100644 --- a/docs/html/resources/resources-data.js +++ b/docs/html/resources/resources-data.js @@ -263,6 +263,17 @@ var ANDROID_RESOURCES = [ } }, { + tags: ['article', 'input', 'ui'], + path: 'articles/spell-checker-framework.html', + title: { + en: 'The Android Spell Checker Framework' + }, + description: { + en: 'This article describes the Android spell checker framework and how to use to implement spell checking in applications.' + } + }, + + { tags: ['article', 'ui'], path: 'articles/touch-mode.html', title: { @@ -548,6 +559,16 @@ var ANDROID_RESOURCES = [ } }, { + tags: ['sample', 'new'], + path: 'samples/KeyChainDemo/index.html', + title: { + en: 'KeyChain Demo' + }, + description: { + en: 'A demo application to demonstrate how to use KeyChain APIs.' + } + }, + { tags: ['sample', 'gamedev', 'media'], path: 'samples/LunarLander/index.html', title: { diff --git a/docs/html/resources/resources_toc.cs b/docs/html/resources/resources_toc.cs index 303a6d4041d4..e4ab16fd987b 100644 --- a/docs/html/resources/resources_toc.cs +++ b/docs/html/resources/resources_toc.cs @@ -100,8 +100,9 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>training/efficient-downloads/index.html"> - <span class="en">Transferring Data Without Draining the Battery</span> - </a> <span class="new">new!</span></div> + <span class="en">Transferring Data Without Draining the Battery<span +class="new"> new!</span></span> + </a></div> <ul> <li><a href="<?cs var:toroot ?>training/efficient-downloads/efficient-network-access.html"> <span class="en">Optimizing Downloads for Efficient Network Access</span> @@ -124,8 +125,8 @@ <li class="toggle-list"> <div><a href="<?cs var:toroot ?>training/search/index.html"> - <span class="en">Adding Search Functionality</span> - </a> <span class="new">new!</span> + <span class="en">Adding Search Functionality<span class="new"> new!</span></span> + </a> </div> <ul> <li><a href="<?cs var:toroot ?>training/search/setup.html"> @@ -278,6 +279,23 @@ </li> </ul> </li> + + <li class="toggle-list"> + <div><a href="<?cs var:toroot ?>training/accessibility/index.html"> + <span class="en">Implementing Accessibility<span class="new"> new!</span></span> + </a></div> + <ul> + <li><a href="<?cs var:toroot ?>training/accessibility/accessible-app.html"> + <span class="en">Developing Accessible Applications</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/accessibility/service.html"> + <span class="en">Developing Accessibility Services</span> + </a> + </li> + </ul> + </li> + </ul> </li> diff --git a/docs/html/resources/samples/get.jd b/docs/html/resources/samples/get.jd index 86ec836119ba..751965ff5b99 100644 --- a/docs/html/resources/samples/get.jd +++ b/docs/html/resources/samples/get.jd @@ -26,15 +26,15 @@ needed!</p> <p>The SDK sample code is available to you as a set of downloadable SDK components, each of which contains the samples for a specific Android platform version. Once you have installed the SDK, you can download one or more samples -component(s) into your SDK environment using the Android SDK and AVD Manager +component(s) into your SDK environment using the Android SDK Manager tool, which is pre-installed in the SDK. </p> -<p>To download the samples, launch the Android SDK and AVD Manager tool and +<p>To download the samples, launch the Android SDK Manager tool and select one of the samples components from the <strong>Available Packages</strong> panel, for example "Samples for SDK API 7". Select <strong>Install Selected</strong>, verify and accept the download, then select <strong>Install Accepted</strong> to download the component into your SDK. If -you aren't familiar with the Android SDK and AVD Manager and how to launch or +you aren't familiar with the Android SDK Manager and how to launch or use it, please read the <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> document. </p> @@ -74,7 +74,7 @@ From there you can read a short summary of each sample application and what types of concepts, features, or APIs it includes. Then, use the links provided to move through the directories and files of each sample. The browseable source is generated from the same source code that is downloadable through the Android -SDK and AVD Manager, as described above. </p> +SDK Manager, as described above. </p> <p>The browseable samples files are available online, at the Android Developers site only and are not included in the downloadable offline documentation. diff --git a/docs/html/resources/samples/images/KeyChainDemo1.png b/docs/html/resources/samples/images/KeyChainDemo1.png Binary files differnew file mode 100644 index 000000000000..d426c225a45e --- /dev/null +++ b/docs/html/resources/samples/images/KeyChainDemo1.png diff --git a/docs/html/resources/samples/images/KeyChainDemo2.png b/docs/html/resources/samples/images/KeyChainDemo2.png Binary files differnew file mode 100755 index 000000000000..e181e5877a5e --- /dev/null +++ b/docs/html/resources/samples/images/KeyChainDemo2.png diff --git a/docs/html/resources/samples/images/KeyChainDemo3.png b/docs/html/resources/samples/images/KeyChainDemo3.png Binary files differnew file mode 100755 index 000000000000..acfdd89f1a07 --- /dev/null +++ b/docs/html/resources/samples/images/KeyChainDemo3.png diff --git a/docs/html/resources/samples/images/KeyChainDemo4.png b/docs/html/resources/samples/images/KeyChainDemo4.png Binary files differnew file mode 100755 index 000000000000..a9101abaee61 --- /dev/null +++ b/docs/html/resources/samples/images/KeyChainDemo4.png diff --git a/docs/html/resources/tutorials/hello-world.jd b/docs/html/resources/tutorials/hello-world.jd index cc8cb3ebd605..70ba06c002e4 100644 --- a/docs/html/resources/tutorials/hello-world.jd +++ b/docs/html/resources/tutorials/hello-world.jd @@ -42,7 +42,7 @@ you need to do it now.</p> <ol> - <li>In the Android SDK and AVD Manager, choose <strong>Available + <li>In the Android SDK Manager, choose <strong>Available Packages</strong> in the left panel.</li> <li>In the right panel, expand the Android Repository list to display @@ -72,7 +72,7 @@ device settings used by the emulator.</p> <p>To create an AVD:</p> <ol> - <li>In Eclipse, select <strong>Window > Android SDK and AVD Manager</strong>.</li> + <li>In Eclipse, select <strong>Window > AVD Manager</strong>.</li> <li>Select <strong>Virtual Devices</strong> in the left panel.</li> <li>Click <strong>New...</strong>. diff --git a/docs/html/resources/tutorials/testing/activity_test.jd b/docs/html/resources/tutorials/testing/activity_test.jd index 4b861e286bbe..f88b7687be1a 100644 --- a/docs/html/resources/tutorials/testing/activity_test.jd +++ b/docs/html/resources/tutorials/testing/activity_test.jd @@ -163,7 +163,7 @@ parent.link=../../browser.html?tag=tutorial open the Android SDK and AVD Manager and check in the <strong>Installed Packages</strong> panel. If aren't sure how to download a platform into your SDK, - read <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>. + read <a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>. </p> </li> </ul> diff --git a/docs/html/sdk/adding-components.jd b/docs/html/sdk/adding-components.jd index ca27bbad0a72..599b2a831f62 100644 --- a/docs/html/sdk/adding-components.jd +++ b/docs/html/sdk/adding-components.jd @@ -1,4 +1,4 @@ -page.title=Adding SDK Components +page.title=Adding SDK Packages @jd:body @@ -6,74 +6,74 @@ page.title=Adding SDK Components <div id="qv"> <h2>Quickview</h2> <ul> - <li>Use the Android SDK and AVD Manager to + <li>Use the Android SDK Manager to set up your SDK and keep it up-to-date.</li> </ul> <h2>In this document</h2> <ol> - <li><a href="#launching">Launching the Android SDK and AVD Manager</a> - <li><a href="#InstallingComponents">Installing SDK Components</a> - <li><a href="#UpdatingComponents">Updating SDK Components</a> - <li><a href="#dependencies">Component Dependencies</a></li> + <li><a href="#launching">Launching the Android SDK Manager</a> + <li><a href="#InstallingComponents">Installing SDK Packages</a> + <li><a href="#UpdatingComponents">Updating SDK Packages</a> + <li><a href="#dependencies">Package Dependencies</a></li> <li><a href="#AddingSites">Adding New Sites</a></li> <li><a href="#troubleshooting">Troubleshooting</a></li> </ol> </div> </div> -<p>Adding and updating components in your Android SDK is fast and easy. To add or -update the individual SDK components that you need, use the <em>Android SDK and AVD +<p>Adding and updating packages in your Android SDK is fast and easy. To add or +update the individual SDK packages that you need, use the <em>Android SDK Manager</em> (included in the SDK Tools).</p> <p>It only takes a couple of clicks to install individual versions of the Android platform, new development tools, new documentation, and SDK add-ons. The -new SDK components are automatically installed into your existing SDK directory, +new SDK packages are automatically installed into your existing SDK directory, so you don't need to update your development environment to specify a new SDK location.</p> <p>If you're setting up your Android SDK for the first time, see <a href="{@docRoot}sdk/installing.html#components">Installing the SDK</a> for information about -what components to install.</p> +what packages to install.</p> <p class="note"><strong>Note:</strong> If you develop in Eclipse, you might also need to update your ADT plugin when you update your development tools. See the revisions listed in the <a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin for Eclipse</a> document.</p> <img src="{@docRoot}images/sdk_manager_packages.png" alt="" /> -<p class="img-caption"><strong>Figure 1.</strong> The Android SDK and AVD Manager's -<strong>Available Packages</strong> panel, which shows the SDK components that are +<p class="img-caption"><strong>Figure 1.</strong> The Android SDK Manager's +<strong>Available Packages</strong> panel, which shows the SDK packages that are available for you to download into your environment. </p> </div> -<h2 id="launching">Launching the Android SDK and AVD Manager</h2> +<h2 id="launching">Launching the Android SDK Manager</h2> -<p>The Android SDK and AVD Manager is the tool that you use to install and -upgrade SDK components in your development environment. </p> +<p>The Android SDK Manager is the tool that you use to install and +upgrade SDK packages in your development environment. </p> -<p>You can launch the Android SDK and AVD Manager in one of the following ways.</p> +<p>You can launch the Android SDK Manager in one of the following ways.</p> <h4>Launching from Eclipse/ADT</h4> <p>If you are developing in Eclipse and have already installed the ADT Plugin, -follow these steps to access the Android SDK and AVD Manager tool:</p> +follow these steps to access the Android SDK Manager tool:</p> <ol> <li>Open Eclipse</li> -<li>Select <strong>Window</strong> > <strong>Android SDK and AVD +<li>Select <strong>Window</strong> > <strong>Android SDK Manager</strong>.</li> </ol> <h4>Launching from the SDK Manager script (Windows only)</h4> -<p>For Windows only, the SDK includes a script that invokes the Android SDK and -AVD Manager. To launch the tool using the script, double-click {@code SDK +<p>For Windows only, the SDK includes a script that invokes the Android SDK Manager. To launch the +tool using the script, double-click {@code SDK Manager.exe} at the root of the the SDK directory.</p> <h4>Launching from a command line</h4> -<p>In all development environments, follow these steps to access the Android SDK -and AVD Manager tool from the command line: </p> +<p>In all development environments, follow these steps to access the Android SDK Manager tool from +the command line: </p> <ol> <li>Navigate to the <code><<em>sdk</em>>/tools/</code> directory.</li> @@ -82,26 +82,26 @@ and AVD Manager tool from the command line: </p> </ol> -<h2 id="InstallingComponents">Installing SDK Components</h2> +<h2 id="InstallingComponents">Installing SDK Packages</h2> -<p class="caution"><strong>Caution:</strong> Before you install SDK components, +<p class="caution"><strong>Caution:</strong> Before you install SDK packages, we recommend that you disable any antivirus software that may be running on your computer. There are cases in which antivirus software on Windows is known to interfere with the installation process, so we suggest you disable your antivirus until installation is complete.</p> -<p>Follow these steps to install new SDK components in your environment:</p> +<p>Follow these steps to install new SDK packages in your environment:</p> <ol> - <li>Launch the Android SDK and AVD Manager as described in the section above.</li> + <li>Launch the Android SDK Manager as described in the section above.</li> <li>Select <strong>Available Packages</strong> in the left panel. - This will reveal all of the components that are currently available for download + This will reveal all of the packages that are currently available for download from the SDK repository.</li> - <li>Select the component(s) you'd like to install and click <strong>Install + <li>Select the package(s) you'd like to install and click <strong>Install Selected</strong>. (If you aren't sure which packages to select, read <a - href="installing.html#which">Recommended Components</a>.)</li> - <li>Verify and accept the components you want (ensure each one is selected with a green -checkmark) and click <strong>Install</strong>. The components will now be installed into + href="installing.html#which">Recommended Packages</a>.)</li> + <li>Verify and accept the packages you want (ensure each one is selected with a green +checkmark) and click <strong>Install</strong>. The packages will now be installed into your existing Android SDK directories.</li> </ol> @@ -114,60 +114,60 @@ and new documentation is saved in the existing <code><sdk>/docs/</code> directory (old docs are replaced).</p> -<h2 id="UpdatingComponents">Updating SDK Components</h2> +<h2 id="UpdatingComponents">Updating SDK Packages</h2> -<p>From time to time, new revisions of existing SDK components are released and +<p>From time to time, new revisions of existing SDK packages are released and made available to you through the SDK repository. In most cases, if you have those -components installed in your environment, you will want +packages installed in your environment, you will want to download the new revisions as soon as possible. </p> <p>You can learn about the release of new revisions in two ways: </p> <ul> <li>You can watch for updates listed in the "SDK" tab of the Android Developers -site, in the "Downloadable SDK Components" section. </li> +site, in the "Downloadable SDK Packages" section. </li> <li>You can watch for updates listed in the <strong>Available Packages</strong> -panel of the Android SDK and AVD Manager. </li> +panel of the Android SDK Manager. </li> </ul> -<p>When you see that a new revision is available, you can use the Android SDK -and AVD Manager to quickly download it to your environment. Follow the same -procedure as given in <a href="#InstallingComponents">Installing SDK Components</a>, above. The new -component is installed in place of the old, but without impacting your +<p>When you see that a new revision is available, you can use the Android SDK Manager to quickly +download it to your environment. Follow the same +procedure as given in <a href="#InstallingComponents">Installing SDK Packages</a>, above. The new +package is installed in place of the old, but without impacting your applications. </p> <p class="note"><strong>Tip:</strong> -Use the "Display updates only" checkbox to show only the components +Use the "Display updates only" checkbox to show only the packages you do not have.</p> -<h2 id="dependencies">SDK Component Dependencies</h2> +<h2 id="dependencies">SDK Package Dependencies</h2> -<p>In some cases, an SDK component may require a specific minimum revision of -another component or SDK tool. Where such dependencies exist, they are -documented in the revision notes for each component, available from the links in -the "Downloadable SDK Components" section at left.</p> +<p>In some cases, an SDK package may require a specific minimum revision of +another package or SDK tool. Where such dependencies exist, they are +documented in the revision notes for each package, available from the links in +the "Downloadable SDK packages" section at left.</p> <p>For example, there may be a dependency between the ADT Plugin for Eclipse and -the SDK Tools component. When you install the SDK Tools -component, you should also upgrade to the required version of ADT (if you +the SDK Tools package. When you install the SDK Tools +package, you should also upgrade to the required version of ADT (if you are developing in Eclipse). In this case, the major version number for your ADT plugin should always match the revision number of your SDK Tools (for example, ADT 8.x requires SDK Tools r8). </p> <p>Also make sure that, each time you install a new version of the Android platform, you have -the latest version of the SDK Platform-tools component. The SDK Platform-tools contain +the latest version of the SDK Platform-tools package. The SDK Platform-tools contain tools that are backward compatible with all versions of the Android platform and are often updated to support new features in the latest version of the Android platform.</p> <p>The development tools will notify you with debug warnings if there is dependency that you need to -address. The SDK and AVD Manager also enforces dependencies by requiring that you download any -components that are needed by those you have selected.</p> +address. The Android SDK Manager also enforces dependencies by requiring that you download any +packages that are needed by those you have selected.</p> <h2 id="AddingSites">Adding New Sites</h2> -<p>By default, <strong>Available Packages</strong> displays components available from the +<p>By default, <strong>Available Packages</strong> displays packages available from the <em>Android Repository</em> and <em>Third party Add-ons</em>. You can add other sites that host their own Android SDK add-ons, then download the SDK add-ons from those sites.</p> @@ -178,7 +178,7 @@ to develop using their libraries, you must install their Android SDK add-on, if available under <em>Third party Add-ons</em>. </p> <p>If a carrier or device manufacturer has hosted an SDK add-on repository file -on their web site, follow these steps to add their site to the SDK and AVD +on their web site, follow these steps to add their site to the Android SDK Manager:</p> <ol> @@ -186,7 +186,7 @@ Manager:</p> <li>Click <strong>Add Add-on Site</strong> and enter the URL of the {@code repository.xml} file. Click <strong>OK</strong>.</li> </ol> -<p>Any SDK components available from the site will now be listed under a new item named +<p>Any SDK packages available from the site will now be listed under a new item named <strong>User Add-ons</strong>.</p> @@ -194,12 +194,12 @@ Manager:</p> <p><strong>Problems connecting to the SDK repository</strong></p> -<p>If you are using the SDK and AVD Manager to download components and are encountering +<p>If you are using the Android SDK Manager to download packages and are encountering connection problems, try connecting over http, rather than https. To switch the -protocol used by the SDK and AVD Manager, follow these steps: </p> +protocol used by the Android SDK Manager, follow these steps: </p> <ol> - <li>With the Android SDK and AVD Manager window open, select "Settings" in the + <li>With the Android SDK Manager window open, select "Settings" in the left pane. </li> <li>On the right, in the "Misc" section, check the checkbox labeled "Force https://... sources to be fetched using http://..." </li> diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd index 39a234f77d71..3acb35885af8 100644 --- a/docs/html/sdk/android-3.0.jd +++ b/docs/html/sdk/android-3.0.jd @@ -25,7 +25,8 @@ Differences Report »</a> </li> <h2>See Also</h2> <ol> - <li><a href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android 3.0</a></li> + <li><a href="{@docRoot}guide/practices/tablets-and-handsets.html">Supporting Tablets and +Handsets</a></li> </ol> </div> @@ -41,7 +42,7 @@ libraries.</p> <p>To get started developing or testing against Android {@sdkPlatformVersion}, use the Android SDK Manager to download the platform into your SDK. For more information, see <a -href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>. If you are new to Android, <a +href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>. If you are new to Android, <a href="{@docRoot}sdk/index.html">download the SDK Starter Package</a> first.</p> <p>For a high-level introduction to Android {@sdkPlatformVersion}, see the <a @@ -52,8 +53,8 @@ Highlights</a>.</p> If you've already published an Android application, please test and optimize your application on Android 3.0 as soon as possible. You should do so to be sure your application provides the best experience possible on the latest Android-powered devices. For information about what you can do, -read <a href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for Android -3.0</a>.</p> +read <a href="{@docRoot}guide/practices/tablets-and-handsets.html">Supporting Tablets and +Handsets</a>.</p> <h2 id="relnotes">Revisions</h2> diff --git a/docs/html/sdk/android-4.0.3.jd b/docs/html/sdk/android-4.0.3.jd index c8563ac2d69a..f6dbee066a6e 100644 --- a/docs/html/sdk/android-4.0.3.jd +++ b/docs/html/sdk/android-4.0.3.jd @@ -68,6 +68,28 @@ the Android 4.0.x system components will not be available for download.</p> <p><a href="#" onclick="return toggleContent(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-content-img" alt="" /> + Revision 3</a> <em>(March 2012)</em> + </a></p> + + <div class="toggle-content-toggleme" style="padding-left:2em;"> + + <p>Maintenance update. The system version is 4.0.4.</p> + <p class="note"><strong>Note:</strong> This system image includes support for emulator +hardware graphics acceleration when used with SDK Tools r17 or higher. +(<a href="{@docRoot}guide/developing/devices/emulator.html#accel-graphics">more info</a>)</p> + <dl> + <dt>Dependencies:</dt> + <dd>SDK Tools r17 or higher is required.</dd> + </dl> + + </div> +</div> + +<div class="toggle-content closed" style="padding-left:1em;"> + + <p><a href="#" onclick="return toggleContent(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" +class="toggle-content-img" alt="" /> Revision 2</a> <em>(January 2012)</em> </a></p> diff --git a/docs/html/sdk/compatibility-library.jd b/docs/html/sdk/compatibility-library.jd index 30d807ff9300..f81e8aea2bfa 100644 --- a/docs/html/sdk/compatibility-library.jd +++ b/docs/html/sdk/compatibility-library.jd @@ -330,13 +330,13 @@ Android 3.2 and higher (all other APIs in the v4 library are already available w <h2 id="Downloading">Downloading the Support Package</h2> -<p>The Support Package is provided as a downloadable package from the Android SDK and AVD +<p>The Support Package is provided as a downloadable package from the Android SDK Manager. To install:</p> <ol> - <li>Launch the SDK and AVD Manager. + <li>Launch the Android SDK Manager. <p>From Eclipse, you can select <strong>Window</strong> -> <strong>Android SDK and AVD Manager</strong>. Or, launch {@code SDK Manager.exe} from +> <strong>Android SDK Manager</strong>. Or, launch {@code SDK Manager.exe} from the {@code <sdk>/} directory (on Windows only) or {@code android} from the {@code <sdk>/tools/} directory.</p></li> <li>Expand the Android Repository, check <strong>Android Support package</strong> diff --git a/docs/html/sdk/eclipse-adt.jd b/docs/html/sdk/eclipse-adt.jd index 3019544b2bbf..e117118b8d04 100644 --- a/docs/html/sdk/eclipse-adt.jd +++ b/docs/html/sdk/eclipse-adt.jd @@ -1,8 +1,8 @@ page.title=ADT Plugin for Eclipse -adt.zip.version=17.0.0 -adt.zip.download=ADT-17.0.0.zip -adt.zip.bytes=12836115 -adt.zip.checksum=ecb12c07e534997cd32c66d57f21b770 +adt.zip.version=18.0.0 +adt.zip.download=ADT-18.0.0.zip +adt.zip.bytes=12834793 +adt.zip.checksum=b446fa157ed97af79d1e21629201efbb @jd:body @@ -36,7 +36,7 @@ that is designed to give you a powerful, integrated environment in which to build Android applications.</p> <p>ADT extends the capabilities of Eclipse to let you quickly set up new Android -projects, create an application UI, add components based on the Android +projects, create an application UI, add packages based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned) {@code .apk} files in order to distribute your application.</p> @@ -108,10 +108,45 @@ padding: .25em 1em; } </style> + <div class="toggleable opened"> <a href="#" onclick="return toggleDiv(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" /> +ADT 18.0.0</a> <em>(April 2012)</em> + <div class="toggleme"> +<dl> + <dt>Dependencies:</dt> + + <dd> + <ul> + <li>Java 1.6 or higher is required for ADT 18.0.0.</li> + <li>Eclipse Helios (Version 3.6.2) or higher is required for ADT 18.0.0.</li> + <li>ADT 18.0.0 is designed for use with <a href="{@docRoot}sdk/tools-notes.html">SDK Tools + r18</a>. If you haven't already installed SDK Tools r18 into your SDK, use the Android SDK + Manager to do so.</li> + </ul> + </dd> + + <dt>Bug fixes:</dt> + <dd> + <ul> + <li>Fixed problem where exporting release package does not recompile libraries in release + mode. + (<a href="http://code.google.com/p/android/issues/detail?id=27940">Issue 27940</a>)</li> + </ul> + </dd> + +</dl> + +</div> +</div> + + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" +width="9px" /> ADT 17.0.0</a> <em>(March 2012)</em> <div class="toggleme"> <dl> @@ -468,7 +503,7 @@ ADT 12.0.0</a> <em>(July 2011)</em> <dd>ADT 12.0.0 is designed for use with <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a>. If you haven't already installed SDK Tools r12 into your SDK, use -the Android SDK and AVD Manager to do so.</dd> +the Android SDK Manager to do so.</dd> <dt>Visual Layout Editor:</dt> <dd> @@ -520,7 +555,7 @@ ADT 11.0.0</a> <em>(June 2011)</em> <dt>Dependencies:</dt> <dd>ADT 11.0.0 is designed for use with SDK Tools r11. If you haven't -already installed SDK Tools r11 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r11 into your SDK, use the Android SDK Manager to do so.</dd> <dt>Visual Refactoring:</dt> @@ -656,7 +691,7 @@ ADT 10.0.1</a> <em>(March 2011)</em> <dt>Dependencies:</dt> <dd>ADT 10.0.1 is designed for use with SDK Tools r10. If you haven't -already installed SDK Tools r10 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r10 into your SDK, use the Android SDK Manager to do so.</dd> <dt>General notes:</dt> @@ -686,7 +721,7 @@ ADT 10.0.0</a> <em>(February 2011)</em> <dt>Dependencies:</dt> <dd>ADT 10.0.0 is designed for use with SDK Tools r10. If you haven't -already installed SDK Tools r10 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r10 into your SDK, use the Android SDK Manager to do so.</dd> <dt>General notes:</dt> @@ -736,7 +771,7 @@ ADT 9.0.0</a> <em>(January 2011)</em> <dt>Dependencies:</dt> <dd>ADT 9.0.0 is designed for use with SDK Tools r9. If you haven't -already installed SDK Tools r9 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r9 into your SDK, use the Android SDK Manager to do so.</dd> <dt>General notes:</dt> @@ -845,7 +880,7 @@ ADT 8.0.1</a> <em>(December 2010)</em> <dt>Dependencies:</dt> <p><p>ADT 8.0.1 is designed for use with SDK Tools r8. If you haven't -already installed SDK Tools r8 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r8 into your SDK, use the Android SDK Manager to do so.</p></dd> <dt>General notes:</dt> @@ -874,7 +909,7 @@ ADT 8.0.0</a> <em>(December 2010)</em> <dt>Dependencies:</dt> <p><p>ADT 8.0.0 is designed for use with SDK Tools r8. If you haven't -already installed SDK Tools r8 into your SDK, use the Android SDK and AVD Manager to do +already installed SDK Tools r8 into your SDK, use the Android SDK Manager to do so.</p></dd> <dt>General notes:</dt> @@ -1020,8 +1055,8 @@ ADT 0.9.6</a> <em>(March 2010)</em> <dt>Dependencies:</dt> <dd><p>ADT 0.9.6 is designed for use with SDK Tools r5 and later. Before -updating to ADT 0.9.6, we highly recommend that you use the Android SDK and -AVD Manager to install SDK Tools r5 into your SDK.</p></dd> +updating to ADT 0.9.6, we highly recommend that you use the Android SDK Manager to install SDK +Tools r5 into your SDK.</p></dd> <dt>General Notes:</dt> <dd> @@ -1038,8 +1073,8 @@ first time with the SDK Usage panel.</li> <dt>AVD/SDK Manager:</dt> <dd> <ul> -<li>Adds support for platform samples components.</li> -<li>Improves support for dependency between components.</li> +<li>Adds support for platform samples packages.</li> +<li>Improves support for dependency between packages.</li> <li>AVDs now sorted by API level.</li> <li>The AVD creation dialog now enforces a minimum SD card size of 9MB.</li> <li>Prevents deletion of running AVDs.</li> @@ -1087,9 +1122,9 @@ ADT 0.9.5</a> <em>(December 2009)</em> <dt>Dependencies:</dt> <dd><p>ADT 0.9.5 requires features provided in SDK Tools r4 or higher. If you install -ADT 0.9.5, which is highly recommended, you should use the Android SDK and AVD +ADT 0.9.5, which is highly recommended, you should use the Android SDK Manager to download the latest SDK Tools into your SDK. For more information, -see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p> +see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>.</p> </dd> <dt>General notes:</dt> @@ -1114,9 +1149,9 @@ ADT 0.9.4</a> <em>(October 2009)</em> <dt>Dependencies:</dt> <dd><p>ADT 0.9.4 requires features provided in SDK Tools r3 or higher. If you install -ADT 0.9.4, which is highly recommended, you should use the Android SDK and AVD +ADT 0.9.4, which is highly recommended, you should use the Android SDK Manager to download the latest SDK Tools into your SDK. For more information, -see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p> +see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>.</p> </dd> <dt>Project Creation Wizard:</dt> @@ -1318,9 +1353,9 @@ to follow these steps again instead of the default update instructions.</p> <h4>Other install errors</h4> <p>Note that there are features of ADT that require some optional -Eclipse components (for example, WST). If you encounter an error when -installing ADT, your Eclipse installion might not include these components. -For information about how to quickly add the necessary components to your +Eclipse packages (for example, WST). If you encounter an error when +installing ADT, your Eclipse installion might not include these packages. +For information about how to quickly add the necessary packages to your Eclipse installation, see the troubleshooting topic <a href="{@docRoot}resources/faq/troubleshooting.html#installeclipsecomponents">ADT Installation Error: "requires plug-in org.eclipse.wst.sse.ui"</a>.</p> @@ -1345,9 +1380,9 @@ you should update to it as soon as convenient. </p> <p>In some cases, a new revision of ADT will have a dependency on a specific revision of the Android SDK Tools. If such dependencies exist, you will need to -update the SDK Tools component of the SDK after installing the new revision of -ADT. To update the SDK Tools component, use the Android SDK and AVD Manager, as -described in <a href="adding-components.html">Adding SDK Components</a>.</p> +update the SDK Tools package of the SDK after installing the new revision of +ADT. To update the SDK Tools package, use the Android SDK Manager, as +described in <a href="adding-components.html">Adding SDK Packages</a>.</p> <p>To learn about new features of each ADT revision and also any dependencies on the SDK Tools, see the listings in the <a href="#notes">Revisions</a> diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd index c09b3c23ef3e..b56ccdbd83f0 100644 --- a/docs/html/sdk/index.jd +++ b/docs/html/sdk/index.jd @@ -2,21 +2,21 @@ page.title=Android SDK page.metaDescription=Download the official Android SDK to develop apps for Android-powered devices. sdk.redirect=0 -sdk.win_installer=installer_r17-windows.exe -sdk.win_installer_bytes=37410775 -sdk.win_installer_checksum=5afaf6511ebaa52bd6d1dba4afc61e41 +sdk.win_installer=installer_r18-windows.exe +sdk.win_installer_bytes=37456234 +sdk.win_installer_checksum=48b1fe7b431afe6b9c8a992bf75dd898 -sdk.win_download=android-sdk_r17-windows.zip -sdk.win_bytes=37417953 -sdk.win_checksum=3af1baeb39707e54df068e939aea5a79 +sdk.win_download=android-sdk_r18-windows.zip +sdk.win_bytes=37448775 +sdk.win_checksum=bfbfdf8b2d0fdecc2a621544d706fa98 -sdk.mac_download=android-sdk_r17-macosx.zip -sdk.mac_bytes=33867836 -sdk.mac_checksum=52639aae036b7c2e47cf291696b23236 +sdk.mac_download=android-sdk_r18-macosx.zip +sdk.mac_bytes=33903758 +sdk.mac_checksum=8328e8a5531c9d6f6f1a0261cb97af36 -sdk.linux_download=android-sdk_r17-linux.tgz -sdk.linux_bytes=29706368 -sdk.linux_checksum=14e99dfa8eb1a8fadd2f3557322245c4 +sdk.linux_download=android-sdk_r18-linux.tgz +sdk.linux_bytes=29731463 +sdk.linux_checksum=6cd716d0e04624b865ffed3c25b3485c @jd:body @@ -28,7 +28,7 @@ sdk.linux_checksum=14e99dfa8eb1a8fadd2f3557322245c4 <li>Install the SDK starter package from the table above. (If you're on Windows, download the installer for help with the initial setup.)</li> <li>Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse).</li> - <li>Add Android platforms and other components to your SDK.</li> + <li>Add Android platforms and other packages to your SDK.</li> <li>Explore the contents of the Android SDK (optional).</li> </ol> diff --git a/docs/html/sdk/installing.jd b/docs/html/sdk/installing.jd index 1dce483c273b..7461eb0c427a 100644 --- a/docs/html/sdk/installing.jd +++ b/docs/html/sdk/installing.jd @@ -53,10 +53,10 @@ function toggleDiv(link) { <li><a href="#Preparing">1. Preparing Your Development Computer</a></li> <li><a href="#Installing">2. Downloading the SDK Starter Package</a></li> <li><a href="#InstallingADT">3. Installing the ADT Plugin for Eclipse</a></li> - <li><a href="#AddingComponents">4. Adding Platforms and Other Components</a> + <li><a href="#AddingComponents">4. Adding Platforms and Other Packages</a> <ol> - <li><a href="#components">Available Components</a></li> - <li><a href="#which">Recommended Components</a></li> + <li><a href="#components">Available Packages</a></li> + <li><a href="#which">Recommended Packages</a></li> </ol></li> <li><a href="#sdkContents">5. Exploring the SDK (Optional)</a></li> <li><a href="#NextSteps">Next Steps</a></li> @@ -66,7 +66,7 @@ function toggleDiv(link) { <h2>See also</h2> <ol> <li><a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin for Eclipse</a></li> - <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></li> + <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a></li> </ol> </div> @@ -81,9 +81,9 @@ this page.</p> <h4>Updating?</h4> -<p>If you already have an Android SDK, use the Android SDK and AVD Manager tool to install +<p>If you already have an Android SDK, use the Android SDK Manager tool to install updated tools and new Android platforms into your existing environment. For information about how to -do that, see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a>.</p> +do that, see <a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>.</p> <h2 id="Preparing">Step 1. Preparing Your Development Computer</h2> @@ -111,7 +111,7 @@ RCP version of Eclipse is recommended.</p> <p>The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can -use to download the rest of the SDK components (such as the latest Android platform).</p> +use to download the rest of the SDK packages (such as the latest Android platform).</p> <p>If you haven't already, get the latest version of the SDK starter package from the <a href="{@docRoot}sdk/index.html">SDK download page</a>.</p> @@ -154,53 +154,53 @@ developing in Eclipse or other IDEs.</p> -<h2 id="AddingComponents">Step 4. Adding Platforms and Other Components</h2> +<h2 id="AddingComponents">Step 4. Adding Platforms and Other Packages</h2> -<p>The last step in setting up your SDK is using the Android SDK and AVD Manager (a -tool included in the SDK starter package) to download essential SDK components into your development +<p>The last step in setting up your SDK is using the Android SDK Manager (a +tool included in the SDK starter package) to download essential SDK packages into your development environment.</p> <p>The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable -components. The SDK starter package, which you've already downloaded, includes only a single -component: the latest version of the SDK Tools. To develop an Android application, you also need to +packages. The SDK starter package, which you've already downloaded, includes only a single +package: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other -components and platforms as well, which is highly recommended.</p> +packages and platforms as well, which is highly recommended.</p> <p>If you used the Windows installer, when you complete the installation wizard, it will launch the -Android SDK and AVD Manager with a default set of platforms and other components selected +Android SDK Manager with a default set of platforms and other packages selected for you to install. Simply click <strong>Install</strong> to accept the recommended set of -components and install them. You can then skip to <a href="#sdkContents">Step 5</a>, but we -recommend you first read the section about the <a href="#components">Available Components</a> to -better understand the components available from the Android SDK and AVD Manager.</p> +packages and install them. You can then skip to <a href="#sdkContents">Step 5</a>, but we +recommend you first read the section about the <a href="#components">Available Packages</a> to +better understand the packages available from the Android SDK Manager.</p> -<p>You can launch the Android SDK and AVD Manager in one of the following ways:</p> +<p>You can launch the Android SDK Manager in one of the following ways:</p> <ul> - <li>From within Eclipse, select <strong>Window > Android SDK and AVD Manager</strong>.</li> + <li>From within Eclipse, select <strong>Window > Android SDK Manager</strong>.</li> <li>On Windows, double-click the <code>SDK Manager.exe</code> file at the root of the Android SDK directory.</li> <li>On Mac or Linux, open a terminal and navigate to the <code>tools/</code> directory in the Android SDK, then execute: <pre>android</pre> </li> </ul> -<p>To download components, use the graphical UI of the Android SDK and AVD +<p>To download packages, use the graphical UI of the Android SDK Manager to browse the SDK repository and select new or updated -components (see figure 1). The Android SDK and AVD Manager installs the selected components in -your SDK environment. For information about which components you should download, see <a -href="#which">Recommended Components</a>.</p> +packages (see figure 1). The Android SDK Manager installs the selected packages in +your SDK environment. For information about which packages you should download, see <a +href="#which">Recommended Packages</a>.</p> <img src="/images/sdk_manager_packages.png" /> -<p class="img-caption"><strong>Figure 1.</strong> The Android SDK and AVD Manager's -<strong>Available Packages</strong> panel, which shows the SDK components that are +<p class="img-caption"><strong>Figure 1.</strong> The Android SDK Manager's +<strong>Available Packages</strong> panel, which shows the SDK packages that are available for you to download into your environment.</p> -<h3 id="components">Available Components</h3> +<h3 id="components">Available Packages</h3> -<p>By default, there are two repositories of components for your SDK: <em>Android +<p>By default, there are two repositories of packages for your SDK: <em>Android Repository</em> and <em>Third party Add-ons</em>.</p> -<p>The <em>Android Repository</em> offers these types of components:</p> +<p>The <em>Android Repository</em> offers these types of packages:</p> <ul> <li><strong>SDK Tools</strong> — Contains tools for debugging and testing your application @@ -219,9 +219,9 @@ developer guide.</li> <li><strong>Android platforms</strong> — An SDK platform is available for every production Android platform deployable to Android-powered devices. Each -SDK platform component includes a fully compliant Android library, system image, sample code, +SDK platform package includes a fully compliant Android library, system image, sample code, and emulator skins. To learn more about a specific platform, see the list of platforms that appears -under the section "Downloadable SDK Components" on the left part of this page.</li> +under the section "Downloadable SDK Packages" on the left part of this page.</li> <li><strong>USB Driver for Windows</strong> (Windows only) — Contains driver files that you can install on your Windows computer, so that you can run and debug @@ -243,16 +243,16 @@ tutorials. --></li> multiversion documentation for the Android framework API. </li> </ul> -<p>The <em>Third party Add-ons</em> provide components that allow you to create a development +<p>The <em>Third party Add-ons</em> provide packages that allow you to create a development environment using a specific Android external library (such as the Google Maps library) or a customized (but fully compliant) Android system image. You can add additional Add-on repositories by clicking <strong>Add Add-on Site</strong>.</p> -<h3 id="which">Recommended Components</h3> +<h3 id="which">Recommended Packages</h3> -<p>The SDK repository contains a range of components that you can download. -Use the table below to determine which components you need, based on whether you +<p>The SDK repository contains a range of packages that you can download. +Use the table below to determine which packages you need, based on whether you want to set up a basic, recommended, or full development environment: </p> @@ -260,7 +260,7 @@ want to set up a basic, recommended, or full development environment: <tr> <th>Environment</th> -<th>SDK Component</th> +<th>SDK Package</th> <th>Comments</th> </tr> @@ -268,8 +268,8 @@ want to set up a basic, recommended, or full development environment: <td rowspan="3" style="font-size:.9em;background-color:#FFE;">Basic</td> <td style="font-size:.9em;background-color:#FFE;">SDK Tools</td> <td style="font-size:.9em;background-color:#FFE;">If you've just installed -the SDK starter package, then you already have the latest version of this component. The -SDK Tools component is required to develop an Android application. Make sure you keep this up to +the SDK starter package, then you already have the latest version of this package. The +SDK Tools package is required to develop an Android application. Make sure you keep this up to date.</td> </tr> @@ -300,21 +300,21 @@ style="border:none"></td> <tr> <td rowspan="3">Recommended<br/>(plus Basic)</td> <td>Documentation</td> -<td>The Documentation component is useful because it lets you work offline and +<td>The Documentation package is useful because it lets you work offline and also look up API reference information from inside Eclipse.</td> </tr> <tr> <td>Samples</td> -<td>The Samples components give you source code that you can use to learn about +<td>The Samples packages give you source code that you can use to learn about Android, load as a project and run, or reuse in your own app. Note that multiple -samples components are available — one for each Android platform version. When -you are choosing a samples component to download, select the one whose API Level +samples packages are available — one for each Android platform version. When +you are choosing a samples package to download, select the one whose API Level matches the API Level of the Android platform that you plan to use.</td> </tr> <tr> <td>Usb Driver</td> -<td>The Usb Driver component is needed only if you are developing on Windows and +<td>The Usb Driver package is needed only if you are developing on Windows and have an Android-powered device on which you want to install your application for debugging and testing. For Mac OS X and Linux platforms, no special driver is needed.</td> @@ -344,12 +344,12 @@ applications on different platforms by running in an Android Virtual Device </table> -<p>Once you've installed at least the basic configuration of SDK components, you're ready to start +<p>Once you've installed at least the basic configuration of SDK packages, you're ready to start developing Android apps. The next section describes the contents of the Android SDK to familiarize -you with the components you've just installed.</p> +you with the packages you've just installed.</p> -<p>For more information about using the Android SDK and AVD Manager, see the <a -href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> document. </p> +<p>For more information about using the Android SDK Manager, see the <a +href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a> document. </p> <h2 id="sdkContents">Step 5. Exploring the SDK (Optional)</h2> @@ -358,7 +358,7 @@ href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a> document. and add-ons that you need, we suggest that you open the SDK directory and take a look at what's inside.</p> -<p>The table below describes the full SDK directory contents, with components +<p>The table below describes the full SDK directory contents, with packages installed. </p> <table> @@ -405,20 +405,21 @@ platform version.</td> <tr> <td colspan="3"><code>tools/</code></td> <td>Contains the set of development and profiling tools that are platform-independent, such -as the emulator, the Android SDK and AVD Manager, <code>ddms</code>, <code>hierarchyviewer</code> -and more. The tools in this directory may be updated at any time using the Android SDK and AVD +as the emulator, the Android SDK Manager, the AVD Manager, <code>ddms</code>, +<code>hierarchyviewer</code> +and more. The tools in this directory may be updated at any time using the Android SDK Manager and are independent of platform releases.</td> </tr> <tr> <td colspan="3"><code>SDK Readme.txt</code></td> <td>A file that explains how to perform the initial setup of your SDK, -including how to launch the Android SDK and AVD Manager tool on all +including how to launch the Android SDK Manager tool on all platforms.</td> </tr> <tr> <td colspan="3"><code>SDK Manager.exe</code></td> -<td>Windows SDK only. A shortcut that launches the Android SDK and AVD -Manager tool, which you use to add components to your SDK.</td> +<td>Windows SDK only. A shortcut that launches the Android SDK +Manager tool, which you use to add packages to your SDK.</td> </tr> <!--<tr> <td colspan="3"><code>documentation.html</code></td> @@ -531,7 +532,7 @@ second step in getting started with Android development. </p> <li>The Android SDK includes sample code and applications for each platform version. You can browse the samples in the <a href="{@docRoot}resources/index.html">Resources</a> tab or download them -into your SDK using the Android SDK and AVD Manager. Once you've downloaded the +into your SDK using the Android SDK Manager. Once you've downloaded the samples, you'll find them in <code><em><sdk></em>/samples/<em><platform>/</em></code>. </li> </ul> diff --git a/docs/html/sdk/ndk/index.jd b/docs/html/sdk/ndk/index.jd index a1c59e3ab0ff..6f06de36e5ac 100644 --- a/docs/html/sdk/ndk/index.jd +++ b/docs/html/sdk/ndk/index.jd @@ -1,16 +1,16 @@ ndk=true -ndk.win_download=android-ndk-r7b-windows.zip -ndk.win_bytes=80346206 -ndk.win_checksum=c42b0c9c14428397337421d5e4999380 +ndk.win_download=android-ndk-r7c-windows.zip +ndk.win_bytes=80361003 +ndk.win_checksum=e86184cdc4bf71d32fa9185fad8544e2 -ndk.mac_download=android-ndk-r7b-darwin-x86.tar.bz2 -ndk.mac_bytes=73817184 -ndk.mac_checksum=6daa82ca6b73bc0614c9997430079c7a +ndk.mac_download=android-ndk-r7c-darwin-x86.tar.bz2 +ndk.mac_bytes=73836512 +ndk.mac_checksum=025f57feb5f32ed993a5fa7f5996477d -ndk.linux_download=android-ndk-r7b-linux-x86.tar.bz2 -ndk.linux_bytes=64349733 -ndk.linux_checksum=0eb8af18796cdaa082df8f7c54ad7f9a +ndk.linux_download=android-ndk-r7c-linux-x86.tar.bz2 +ndk.linux_bytes=63432410 +ndk.linux_checksum=0bc21b78823dcf6f86b988203626b1fe page.title=Android NDK @@ -62,6 +62,59 @@ padding: .25em 1em; <div class="toggleable open"> <a href="#" onclick="return toggleDiv(this)"><img src= "{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px"> + Android NDK, Revision 7c</a> <em>(March 2012)</em> + + <div class="toggleme"> + <p>This release of the NDK includes an important fix for Tegra2-based devices, and a few +additional fixes and improvements:</p> + + <dl> + <dt>Important bug fixes:</dt> + + <dd> + <ul> + <li>Fixed GNU STL armeabi-v7a binaries to not crash on non-NEON + devices. The files provided with NDK r7b were not configured properly, + resulting in crashes on Tegra2-based devices and others when trying to use + certain floating-point functions (e.g., {@code cosf}, {@code sinf}, {@code expf}).</li> + </ul> + </dd> + + <dt>Important changes:</dt> + + <dd> + <ul> + <li>Added support for custom output directories through the {@code NDK_OUT} + environment variable. When defined, this variable is used to store all + intermediate generated files, instead of {@code $PROJECT_PATH/obj}. The variable is + also recognized by {@code ndk-gdb}. </li> + <li>Added support for building modules with hundreds or even thousands of source + files by defining {@code LOCAL_SHORT_COMMANDS} to {@code true} in your {@code Android.mk}. + <p>This change forces the NDK build system to put most linker or archiver options + into list files, as a work-around for command-line length limitations. + See {@code docs/ANDROID-MK.html} for details.</p> + </li> + </ul> + </dd> + + <dt>Other bug fixes:</dt> + + <dd> + <ul> + <li>Fixed {@code android_getCpuCount()} implementation in the {@code cpufeatures} +helper library. On certain devices, where cores are enabled dynamically by the system, the previous +implementation would report the total number of <em>active</em> cores the first time the function +was called, rather than the total number of <em>physically available</em> cores.</li> + </ul> + </dd> + </dl> + </div> +</div> + + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"><img src= + "{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px"> Android NDK, Revision 7b</a> <em>(February 2012)</em> <div class="toggleme"> diff --git a/docs/html/sdk/oem-usb.jd b/docs/html/sdk/oem-usb.jd index 818a0af2fbc8..88d66dd3a4f8 100644 --- a/docs/html/sdk/oem-usb.jd +++ b/docs/html/sdk/oem-usb.jd @@ -314,6 +314,10 @@ href="http://developer.sonyericsson.com/wportal/devworld/search-downloads/driver href="http://www.teleepoch.com/android.html">http://www.teleepoch.com/android.html</a></td> </tr> +<tr><td>Yulong Coolpad</td> <td><a +href="http://www.yulong.com/product/product/product/downloadList.html#downListUL">http://www.yulong.com/product/product/product/downloadList.html#downListUL</a></td> +</tr> + <tr> <td>ZTE</td> <td><a href="http://support.zte.com.cn/support/news/NewsDetail.aspx?newsId=1000442">http://support.zte.com.cn/support/news/NewsDetail.aspx?newsId=1000442</a></td></tr> diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs index 5a5517c5ea1d..3aafea9e9c28 100644 --- a/docs/html/sdk/sdk_toc.cs +++ b/docs/html/sdk/sdk_toc.cs @@ -40,8 +40,7 @@ <li> <span class="heading">Android 3.0 Preview SDK</span> <ul> - <li><a href="<?cs var:toroot ?>sdk/preview/start.html">Getting Started</a> <span -class="new">new!</span></li> + <li><a href="<?cs var:toroot ?>sdk/preview/start.html">Getting Started</a></li> </ul> </li><?cs /if ?> @@ -55,7 +54,7 @@ class="new">new!</span></li> /if ?> <li> <span class="heading"> - <span class="en">Downloadable SDK Components</span> + <span class="en">Downloadable SDK Packages</span> <span style="display:none" class="de"></span> <span style="display:none" class="es"></span> <span style="display:none" class="fr"></span> @@ -66,7 +65,7 @@ class="new">new!</span></li> </span> <ul> <li><a href="<?cs var:toroot ?>sdk/adding-components.html"> - <span class="en">Adding SDK Components</span> + <span class="en">Adding SDK Packages</span> <span style="display:none" class="de"></span> <span style="display:none" class="es"></span> <span style="display:none" class="fr"></span> @@ -79,10 +78,9 @@ class="new">new!</span></li> <ul> <li class="toggle-list"> <div><a href="<?cs var:toroot ?>sdk/android-4.0-highlights.html"> - <span class="en">Android 4.0.x Platform</span></a> <span class="new">new!</span></div> + <span class="en">Android 4.0.x Platform</span></a></div> <ul> - <li><a href="<?cs var:toroot ?>sdk/android-4.0.3.html">Android 4.0.3 Platform</a> - <span class="new">new!</span></li> + <li><a href="<?cs var:toroot ?>sdk/android-4.0.3.html">Android 4.0.3 Platform</a></li> <li><a href="<?cs var:toroot ?>sdk/android-4.0.html">Android 4.0 Platform</a> </li> </ul> </li> @@ -153,11 +151,9 @@ class="new">new!</span></li> </li> </ul> <ul> - <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r17</a> <span -class="new">new!</span></li> + <li><a href="<?cs var:toroot ?>sdk/tools-notes.html">SDK Tools, r18</a></li> <li><a href="<?cs var:toroot ?>sdk/win-usb.html">Google USB Driver, r4</a></li> - <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Support Package, r7</a> - <span class="new">new!</span></li> + <li><a href="<?cs var:toroot ?>sdk/compatibility-library.html">Support Package, r7</a></li> </ul> </li> <li> @@ -172,15 +168,14 @@ class="new">new!</span></li> <span style="display:none" class="zh-TW"></span> </span> <ul> - <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 17.0.0 + <li><a href="<?cs var:toroot ?>sdk/eclipse-adt.html">ADT 18.0.0 <span style="display:none" class="de"></span> <span style="display:none" class="es"></span> <span style="display:none" class="fr"></span> <span style="display:none" class="it"></span> <span style="display:none" class="ja"></span> <span style="display:none" class="zh-CN"></span> - <span style="display:none" class="zh-TW"></span></a> <span -class="new">new!</span> + <span style="display:none" class="zh-TW"></span></a> </li> </ul> </li> @@ -196,7 +191,7 @@ class="new">new!</span> <span style="display:none" class="zh-TW"></span> </span> <ul> - <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r7b</a> + <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r7c</a> <span class="new">new!</span> </li> <li><a href="<?cs var:toroot ?>sdk/ndk/overview.html">What is the NDK?</a></li> diff --git a/docs/html/sdk/tools-notes.jd b/docs/html/sdk/tools-notes.jd index dea0c389d95e..f4e9d4d59e14 100644 --- a/docs/html/sdk/tools-notes.jd +++ b/docs/html/sdk/tools-notes.jd @@ -68,6 +68,48 @@ padding: .25em 1em; <a href="#" onclick="return toggleDiv(this)"> <img src="{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px" /> + SDK Tools, Revision 18</a> <em>(April 2012)</em> + + <div class="toggleme"> + <p class="caution"><strong>Important:</strong> To download the new Android + 4.0 system components from the Android SDK Manager, you must first update the + SDK tools to revision 14 or later and restart the Android SDK Manager. If you do not, + the Android 4.0 system components will not be available for download.</p> + + <dl> + <dt>Dependencies:</dt> + <dd> + <ul> + <li>Android SDK Platform-tools revision 9 or later.</li> + <li>If you are developing in Eclipse with ADT, note that the SDK Tools r18 is designed for + use with ADT 18.0.0 and later. If you haven't already, we highly recommend updating your + <a href="{@docRoot}sdk/eclipse-adt.html">ADT Plugin</a> to 18.0.0.</li> + <li>If you are developing outside Eclipse, you must have + <a href="http://ant.apache.org/">Apache Ant</a> 1.8 or later.</li> + </ul> + </dd> + <dt>General notes:</dt> + <dd> + <ul> + <li>Updated the SdkController app to encapsulate both sensor and multitouch emulation + functionality.</li> + </ul> + </dd> + <dt>Bug fixes:</dt> + <dd> + <ul> + <li>Fixed Ant issues where some jar libraries in the {@code libs/} folder are not picked up +in some cases.</li> + </ul> + </dd> + </dl> + </div> +</div> + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"> + <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" + width="9px" /> SDK Tools, Revision 17</a> <em>(March 2012)</em> <div class="toggleme"> @@ -96,12 +138,13 @@ padding: .25em 1em; <li>Added support for hardware accelerated graphics rendering. This feature requires an API Level 15, Revision 3 or later system image. (<a href="{@docRoot}guide/developing/devices/emulator.html#accel-graphics">more info</a>) - <p class="note"><strong>Note:</strong> As of the SDK Tools Revision 17 release, the -API Level 15, Revision 3 system image is not yet available.</p> </li> <li>Added support for running Android x86 system images in virtualization mode on Windows and Mac OS X. -(<a href="{@docRoot}guide/developing/devices/emulator.html#accel-vm">more info</a>)</li> +(<a href="{@docRoot}guide/developing/devices/emulator.html#accel-vm">more info</a>) + <p class="note"><strong>Note:</strong> Use the Android SDK Manager to download and +install x86 system images. Android x86 system images are not available for all API levels.</p> + </li> <li>Added experimental support for multi-touch input by enabing the emulator to receive touch input from a USB-tethered physical Android device. (<a href="http://tools.android.com/tips/hardware-emulation">more info</a>)</li> diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd index 6869d7465f3d..3be0faf99bfc 100644 --- a/docs/html/sdk/win-usb.jd +++ b/docs/html/sdk/win-usb.jd @@ -12,7 +12,7 @@ page.title=Google USB Driver <ol> <li><a href="{@docRoot}sdk/oem-usb.html#InstallingDriver">Installing a USB Driver</a></li> <li><a href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a></li> - <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></li> + <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a></li> </ol> </div> </div> @@ -51,7 +51,7 @@ for Windows. </p> <p>The sections below provide notes about successive revisions of the USB Driver for Windows, as denoted by revision number. To determine what revision of the USB Driver for Windows you are using, refer to the "Installed Packages" listing -in the Android SDK and AVD Manager.</p> +in the Android SDK Manager.</p> <script type="text/javascript"> function toggleDiv(link) { @@ -149,7 +149,7 @@ for the T-Mobile G1 and myTouch 3G (and similar devices).</p></dt> <div class="figure" style="width:536px;margin:0"> <img src="{@docRoot}images/developing/sdk-usb-driver.png" alt="" /> - <p class="img-caption"><strong>Figure 1.</strong> The SDK and AVD Manager + <p class="img-caption"><strong>Figure 1.</strong> The SDK Manager with the Google USB Driver selected.</p> </div> @@ -158,10 +158,10 @@ component. You need the driver only if you are developing on Windows and want to connect an Android-powered device (ADP, Nexus One, or Nexus S) to your development environment over USB. </p> -<p>To download the driver, use the Android SDK and AVD Manager tool that is +<p>To download the driver, use the Android SDK Manager tool that is included with the <a href="{@docRoot}sdk/index.html">Android SDK</a>:</p> <ol> - <li>Launch the SDK and AVD Manager by double-clicking <code>SDK Manager.exe</code>, + <li>Launch the Android SDK Manager by double-clicking <code>SDK Manager.exe</code>, at the root of your SDK directory.</li> <li>Expand <em>Extras</em>.</li> <li>Check <strong>Google USB Driver package</strong> and click <strong>Install</strong>.</li> diff --git a/docs/html/shareables/training/LocationAware.zip b/docs/html/shareables/training/LocationAware.zip Binary files differnew file mode 100644 index 000000000000..e1926faa6930 --- /dev/null +++ b/docs/html/shareables/training/LocationAware.zip diff --git a/docs/html/training/accessibility/accessible-app.jd b/docs/html/training/accessibility/accessible-app.jd new file mode 100644 index 000000000000..f4087b828bfd --- /dev/null +++ b/docs/html/training/accessibility/accessible-app.jd @@ -0,0 +1,194 @@ + +page.title=Developing Accessible Applications +parent.title=Implementing Accessibility +parent.link=index.html + +trainingnavtop=true +next.title=Developing an Accessibility Service +next.link=service.html + +@jd:body + + + + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#contentdesc">Add Content Descriptions</a></li> + <li><a href="#focus">Design for Focus Navigation</a></li> + <li><a href="#events">Fire Accessibility Events</a></li> + <li><a href="#testing">Test Your Application</a></li> +</ol> + +<!-- other docs (NOT javadocs) --> +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/topics/ui/accessibility/apps.html">Making + Applications Accessible</a></li> +</ul> + + +</div> +</div> + +<p>Android has several accessibility-focused features baked into the platform, +which make it easy to optimize your application for those with visual or +physical disabilities. However, it's not always obvious what the correct +optimizations are, or the easiest way to leverage the framework toward this +purpose. This lesson shows you how to implement the strategies and platform +features that make for a great accessibility-enabled Android application.</p> + +<h2 id="contentdesc">Add Content Descriptions</h2> +<p>A well-designed user interface (UI) often has elements that don't require an explicit +label to indicate their purpose to the user. A checkbox next to an item in a +task list application has a fairly obvious purpose, as does a trash can in a file +manager application. However, to your users with vision impairment, other UI +cues are needed.</p> + +<p>Fortunately, it's easy to add labels to UI elements in your application that +can be read out loud to your user by a speech-based accessibility service like <a + href="https://market.android.com/details?id=com.google.android.marvin.talkback">TalkBack</a>. +If you have a label that's likely not to change during the lifecycle of the +application (such as "Pause" or "Purchase"), you can add it via the XML layout, +by setting a UI element's <a + href="{@docRoot}reference/android/view.View#attr_android:contentDescription">android:contentDescription</a> attribute, like in this +example:</p> +<pre> +<Button + android:id=”@+id/pause_button” + android:src=”@drawable/pause” + android:contentDescription=”@string/pause”/> +</pre> + +<p>However, there are plenty of situations where it's desirable to base the content +description on some context, such as the state of a toggle button, or a piece +selectable data like a list item. To edit the content description at runtime, +use the {@link android.view.View#setContentDescription(CharSequence) +setContentDescription()} method, like this:</p> + +<pre> +String contentDescription = "Select " + strValues[position]; +label.setContentDescription(contentDescription); +</pre> + +<p>This addition to your code is the simplest accessibility improvement you can make to your +application, but one of the most useful. Try to add content descriptions +wherever there's useful information, but avoid the web-developer pitfall of +labelling <em>everything</em> with useless information. For instance, don't set +an application icon's content description to "app icon". That just increases +the noise a user needs to navigate in order to pull useful information from your +interface.</p> + +<p>Try it out! Download <a + href="https://market.android.com/details?id=com.google.android.marvin.talkback">TalkBack</a> +(an accessibility service published by Google) and enable it in <strong>Settings + > Accessibility > TalkBack</strong>. Then navigate around your own +application and listen for the audible cues provided by TalkBack.</p> + +<h2 id="focus">Design for Focus Navigation</h2> +<p>Your application should support more methods of navigation than the +touch screen alone. Many Android devices come with navigation hardware other +than the touchscreen, like a D-Pad, arrow keys, or a trackball. In addition, +later Android releases also support connecting external devices like keyboards +via USB or bluetooth.</p> + +<p>In order to enable this form of navigation, all navigational elements that +the user should be able to navigate to need to be set as focusable. This +modification can be +done at runtime using the +{@link android.view.View#setFocusable View.setFocusable()} method on that UI +control, or by setting the <a + href="{@docRoot}android.view.View#attr_android:focusable">{@code + android:focusable}</a> +attrubute in your XML layout files.</p> + +<p>Also, each UI control has 4 attributes, +<a href="{@docRoot}reference/android/view/View#attr_android:nextFocusUp">{@code + android:nextFocusUp}</a>, +<a + href="{@docRoot}reference/android/view/View#attr_android:nextFocusDown">{@code + android:nextFocusDown}</a>, +<a + href="{@docRoot}reference/android/view/View#attr_android:nextFocusLeft">{@code + android:nextFocusLeft}</a>, +and <a + href="{@docRoot}reference/android/view/View#attr_android:nextFocusRight">{@code + android:nextFocusRight}</a>, +which you can use to designate +the next view to receive focus when the user navigates in that direction. While +the platform determines navigation sequences automatically based on layout +proximity, you can use these attributes to override that sequence if it isn't +appropriate in your application. </p> + +<p>For instance, here's how you represent a button and label, both +focusable, such that pressing down takes you from the button to the text view, and +pressing up would take you back to the button.</p> + + +<pre> +<Button android:id="@+id/doSomething" + android:focusable="true" + android:nextFocusDown=”@id/label” + ... /> +<TextView android:id="@+id/label" + android:focusable=”true” + android:text="@string/labelText" + android:nextFocusUp=”@id/doSomething” + ... /> +</pre> + +<p>Verify that your application works intuitively in these situations. The +easiest way is to simply run your application in the Android emulator, and +navigate around the UI with the emulator's arrow keys, using the OK button as a +replacement for touch to select UI controls.</p> + +<h2 id="events">Fire Accessibility Events</h2> +<p>If you're using the view components in the Android framework, an +{@link android.view.accessibility.AccessibilityEvent} is created whenever you +select an item or change focus in your UI. These events are examined by the +accessibility service, enabling it to provide features like text-to-speech to +the user.</p> + +<p>If you write a custom view, make sure it fires events at the appropriate +times. Generate events by calling {@link +android.view.View#sendAccessibilityEvent(int)}, with a parameter representing +the type of event that occurred. A complete list of the event types currently +supported can be found in the {@link +android.view.accessibility.AccessibilityEvent} reference documentation. + +<p>As an example, if you want to extend an image view such that you can write +captions by typing on the keyboard when it has focus, it makes sense to fire an +{@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} +event, even though that's not normally built into image views. The code to +generate that event would look like this:</p> +<pre> +public void onTextChanged(String before, String after) { + ... + if (AccessibilityManager.getInstance(mContext).isEnabled()) { + sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED); + } + ... +} +</pre> + +<h2 id="testing">Test Your Application</h2> +<p>Be sure to test the accessibility functionality as you add it to your +application. In order to test the content descriptions and Accessibility +events, install and enable an accessibility service. One option is <a + href="https://play.google.com/store/details?id=com.google.android.marvin.talkback">Talkback</a>, +a free, open source screen reader available on Google Play. With the service +enabled, test all the navigation flows through your application and listen to +the spoken feedback.</p> + +<p>Also, attempt to navigate your application using a directional controller, +instead of the touch screen. You can use a physical device with a d-pad or +trackball if one is available. If not, use the Android emulator and it's +simulated keyboard controls.</p> + +<p>Between the service providing feedback and the directional navigation through +your application, you should get a sense of what your application is like to +navigate without any visual cues. Fix problem areas as they appear, and you'll +end up with with a more accessible Android application.</p> diff --git a/docs/html/training/accessibility/index.jd b/docs/html/training/accessibility/index.jd new file mode 100644 index 000000000000..d5178a9a2551 --- /dev/null +++ b/docs/html/training/accessibility/index.jd @@ -0,0 +1,56 @@ +page.title=Implementing Accessibility + +trainingnavtop=true +startpage=true +next.title=Developing Accessible Applications +next.link=accessible-app.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>Dependencies and prerequisites</h2> +<ul> + <li>Android 2.0 (API Level 5) or higher</li> +Playback</a></li> +</ul> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a></li> +</ul> + +</div> +</div> + +<p>When it comes to reaching as wide a userbase as possible, it's important to +pay attention to accessibility in your Android application. Cues in your user +interface that may work for a majority of users, such as a visible change in +state when a button is pressed, can be less optimal if the user is visually +impaired.</p> + +<p>This class shows you how to make the most of the accessibility features +built into the Android framework. It covers how to optimize your app for +accessibility, leveraging platform features like focus navigation and content +descriptions. It also covers how to build accessibility services, that can +facilitate user interaction with <strong>any</strong> Android application, not +just your own.</p> + +<h2>Lessons</h2> + +<dl> + <dt><b><a href="accessible-app.html">Developing Accessible Applications</a></b></dt> + <dd>Learn to make your Android application accessible. Allow for easy + navigation with a keyboard or directional pad, set labels and fire events + that can be interpreted by an accessibility service to facilitate a smooth + user experience.</dd> + + <dt><b><a href="service.html">Developing Accessibility Services</a></b></dt> + <dd>Develop an accessibility service that listens for accessibility events, + mines those events for information like event type and content descriptions, + and uses that information to communicate with the user. The example will + use a text-to-speech engine to speak to the user.</dd> + +</dl> + diff --git a/docs/html/training/accessibility/service.jd b/docs/html/training/accessibility/service.jd new file mode 100644 index 000000000000..f62506b1baa2 --- /dev/null +++ b/docs/html/training/accessibility/service.jd @@ -0,0 +1,286 @@ + +page.title=Developing an Accessibility Service +parent.title=Implementing Accessibility +parent.link=index.html + +trainingnavtop=true +previous.title=Developing Accessible Applications +previous.link=accessible-app.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#create">Create Your Accessibility Service</a></li> + <li><a href="#configure">Configure Your Accessibility Service</a></li> + <li><a href="#events">Respond to AccessibilityEvents</a></li> + <li><a href="#query">Query the View Heirarchy for More Context</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}guide/topics/ui/accessibility/services.html">Building + Accessibility Services</a></li> +</ul> + +</div> +</div> + + +<p>Accessibility services are a feature of the Android framework designed to +provide alternative navigation feedback to the user on behalf of applications +installed on Android devices. An accessibility service can communicate to the +user on the application's behalf, such as converting text to speech, or haptic +feedback when a user is hovering on an important area of the screen. This +lesson covers how to create an accessibility service, process information +received from the application, and report that information back to the +user.</p> + + +<h2 id="create">Create Your Accessibility Service</h2> +<p>An accessibility service can be bundled with a normal application, or created +as a standalone Android project. The steps to creating the service are the same +in either situation. Within your project, create a class that extends {@link +android.accessibilityservice.AccessibilityService}.</p> + +<pre> +package com.example.android.apis.accessibility; + +import android.accessibilityservice.AccessibilityService; + +public class MyAccessibilityService extends AccessibilityService { +... + @Override + public void onAccessibilityEvent(AccessibilityEvent event) { + } + + @Override + public void onInterrupt() { + } + +... +} +</pre> + +<p>Like any other service, you also declare it in the manifest file. +Remember to specify that it handles the {@code android.accessibilityservice} intent, +so that the service is called when applications fire an +{@link android.view.accessibility.AccessibilityEvent}.</p> + +<pre> +<application ...> +... +<service android:name=".MyAccessibilityService"> + <intent-filter> + <action android:name="android.accessibilityservice.AccessibilityService" /> + </intent-filter> + . . . +</service> +... +</application> +</pre> + +<p>If you created a new project for this service, and don't plan on having an +application, you can remove the starter Activity class (usually called MainActivity.java) from your source. Remember to +also remove the corresponding activity element from your manifest.</p> + +<h2 id="configure">Configure Your Accessibility Service</h2> +<p>Setting the configuration variables for your accessibility service tells the +system how and when you want it to run. Which event types would you like to +respond to? Should the service be active for all applications, or only specific +package names? What different feedback types does it use?</p> + +<p>You have two options for how to set these variables. The +backwards-compatible option is to set them in code, using {@link +android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. +To do that, override the {@link +android.accessibilityservice.AccessibilityService#onServiceConnected()} method +and configure your service in there.</p> + +<pre> +@Override +public void onServiceConnected() { + // Set the type of events that this service wants to listen to. Others + // won't be passed to this service. + info.eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED | + AccessibilityEvent.TYPE_VIEW_FOCUSED; + + // If you only want this service to work with specific applications, set their + // package names here. Otherwise, when the service is activated, it will listen + // to events from all applications. + info.packageNames = new String[] + {"com.example.android.myFirstApp", "com.example.android.mySecondApp"}; + + // Set the type of feedback your service will provide. + info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN; + + // Default services are invoked only if no package-specific ones are present + // for the type of AccessibilityEvent generated. This service *is* + // application-specific, so the flag isn't necessary. If this was a + // general-purpose service, it would be worth considering setting the + // DEFAULT flag. + + // info.flags = AccessibilityServiceInfo.DEFAULT; + + info.notificationTimeout = 100; + + this.setServiceInfo(info); + +} +</pre> + +<p>Starting with Android 4.0, there is a second option available: configure the +service using an XML file. Certain configuration options like +{@link android.R.attr#canRetrieveWindowContent} are only available if you +configure your service using XML. The same configuration options above, defined +using XML, would look like this:</p> + +<pre> +<accessibility-service + android:accessibilityEventTypes="typeViewClicked|typeViewFocused" + android:packageNames="com.example.android.myFirstApp, com.example.android.mySecondApp" + android:accessibilityFeedbackType="feedbackSpoken" + android:notificationTimeout="100" + android:settingsActivity="com.example.android.apis.accessibility.TestBackActivity" + android:canRetrieveWindowContent="true" +/> +</pre> + +<p>If you go the XML route, be sure to reference it in your manifest, by adding +a <a +href="{@docRoot}guide/topics/manifest/meta-data-element.html"><meta-data></a> tag to +your service declaration, pointing at the XML file. If you stored your XML file +in {@code res/xml/serviceconfig.xml}, the new tag would look like this:</p> + +<pre> +<service android:name=".MyAccessibilityService"> + <intent-filter> + <action android:name="android.accessibilityservice.AccessibilityService" /> + </intent-filter> + <meta-data android:name="android.accessibilityservice" + android:resource="@xml/serviceconfig" /> +</service> +</pre> + +<h2 id="events">Respond to AccessibilityEvents</h2> +<p>Now that your service is set up to run and listen for events, write some code +so it knows what to do when an {@link +android.view.accessibility.AccessibilityEvent} actually arrives! Start by +overriding the {@link +android.accessibilityservice.AccessibilityService#onAccessibilityEvent} method. +In that method, use {@link +android.view.accessibility.AccessibilityEvent#getEventType} to determine the +type of event, and {@link +android.view.accessibility.AccessibilityEvent#getContentDescription} to extract +any label text associated with the fiew that fired the event.</pre> + +<pre> +@Override +public void onAccessibilityEvent(AccessibilityEvent event) { + final int eventType = event.getEventType(); + String eventText = null; + switch(eventType) { + case AccessibilityEvent.TYPE_VIEW_CLICKED: + eventText = "Focused: "; + break; + case AccessibilityEvent.TYPE_VIEW_FOCUSED: + eventText = "Focused: "; + break; + } + + eventText = eventText + event.getContentDescription(); + + // Do something nifty with this text, like speak the composed string + // back to the user. + speakToUser(eventText); + ... +} +</pre> + +<h2 id="query">Query the View Heirarchy for More Context</h2> +<p>This step is optional, but highly useful. One of the new features in Android +4.0 (API Level 14) is the ability for an +{@link android.accessibilityservice.AccessibilityService} to query the view +hierarchy, collecting information about the the UI component that generated an event, and +its parent and children. In order to do this, make sure that you set the +following line in your XML configuration:</p> +<pre> +android:canRetrieveWindowContent="true" +</pre> +<p>Once that's done, get an {@link +android.view.accessibility.AccessibilityNodeInfo} object using {@link +android.view.accessibility.AccessibilityEvent#getSource}. This call only +returns an object if the window where the event originated is still the active +window. If not, it will return null, so <em>behave accordingly</em>. The +following example is a snippet of code that, when it receives an event, does +the following: +<ol> + <li>Immediately grab the parent of the view where the event originated</li> + <li>In that view, look for a label and a check box as children views</li> + <li>If it finds them, create a string to report to the user, indicating + the label and whether it was checked or not.</li> + <li>If at any point a null value is returned while traversing the view + hierarchy, the method quietly gives up.</li> +</ol> + +<pre> + +// Alternative onAccessibilityEvent, that uses AccessibilityNodeInfo + +@Override +public void onAccessibilityEvent(AccessibilityEvent event) { + + AccessibilityNodeInfo source = event.getSource(); + if (source == null) { + return; + } + + // Grab the parent of the view that fired the event. + AccessibilityNodeInfo rowNode = getListItemNodeInfo(source); + if (rowNode == null) { + return; + } + + // Using this parent, get references to both child nodes, the label and the checkbox. + AccessibilityNodeInfo labelNode = rowNode.getChild(0); + if (labelNode == null) { + rowNode.recycle(); + return; + } + + AccessibilityNodeInfo completeNode = rowNode.getChild(1); + if (completeNode == null) { + rowNode.recycle(); + return; + } + + // Determine what the task is and whether or not it's complete, based on + // the text inside the label, and the state of the check-box. + if (rowNode.getChildCount() < 2 || !rowNode.getChild(1).isCheckable()) { + rowNode.recycle(); + return; + } + + CharSequence taskLabel = labelNode.getText(); + final boolean isComplete = completeNode.isChecked(); + String completeStr = null; + + if (isComplete) { + completeStr = getString(R.string.checked); + } else { + completeStr = getString(R.string.not_checked); + } + String reportStr = taskLabel + completeStr; + speakToUser(reportStr); +} + +</pre> + +<p>Now you have a complete, functioning accessibility service. Try configuring +how it interacts with the user, by adding Android's <a + href="http://developer.android.com/resources/articles/tts.html">text-to-speech + engine</a>, or using a {@link android.os.Vibrator} to provide haptic +feedback!</p> diff --git a/docs/html/training/location/currentlocation.jd b/docs/html/training/location/currentlocation.jd new file mode 100644 index 000000000000..4692530e5e98 --- /dev/null +++ b/docs/html/training/location/currentlocation.jd @@ -0,0 +1,155 @@ +page.title=Obtaining the Current Location +parent.title=Making Your App Location Aware +parent.link=index.html + +trainingnavtop=true +previous.title=Using the Location Manager +previous.link=locationmanager.html +next.title=Displaying the Location Address +next.link=geocoding.html + + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="currentlocation.html#TaskSetupLocationListener">Set Up the Location Listener</a></li> + <li><a href="currentlocation.html#TaskHandleLocationUpdates">Handle Multiple Sources of Location Updates</a></li> + <li><a href="currentlocation.html#TaskGetLastKnownLocation">Use getLastKnownLocation() Wisely</a></li> + <li><a href="currentlocation.html#TaskTerminateUpdates">Terminate Location Updates</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> +<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download + the sample app</a> +<p class="filename">LocationAware.zip</p> +</div> + +</div> +</div> + +<p>After setting up your application to work with {@link android.location.LocationManager}, you can begin to obtain location updates.</p> + +<h2 id="TaskSetupLocationListener">Set Up the Location Listener</h2> + +<p>The {@link android.location.LocationManager} class exposes a number of methods for applications to receive location updates. In its simplest form, you register an event listener, identify the location manager from which you'd like to receive location updates, and specify the minimum time and distance intervals at which to receive location updates. The {@link android.location.LocationListener#onLocationChanged(android.location.Location) onLocationChanged()} callback will be invoked with the frequency that correlates with time and distance intervals.</p> + +<p> +In the sample code snippet below, the location listener is set up to receive notifications at least every 10 seconds and if the device moves by more than 10 meters. The other callback methods notify the application any status change coming from the location provider. +</p> + +<pre> +private final LocationListener listener = new LocationListener() { + + @Override + public void onLocationChanged(Location location) { + // A new location update is received. Do something useful with it. In this case, + // we're sending the update to a handler which then updates the UI with the new + // location. + Message.obtain(mHandler, + UPDATE_LATLNG, + location.getLatitude() + ", " + + location.getLongitude()).sendToTarget(); + + ... + } + ... +}; + +mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, + 10000, // 10-second interval. + 10, // 10 meters. + listener); +</pre> + +<h2 id="TaskHandleLocationUpdates">Handle Multiple Sources of Location Updates</h2> + +<p>Generally speaking, a location provider with greater accuracy (GPS) requires a longer fix time than one with lower accuracy (network-based). If you want to display location data as quickly as possible and update it as more accurate data becomes available, a common practice is to register a location listener with both GPS and network providers. In the {@link android.location.LocationListener#onLocationChanged(android.location.Location) onLocationChanged()} callback, you'll receive location updates from multiple location providers that may have different timestamps and varying levels of accuracy. You'll need to incorporate logic to disambiguate the location providers and discard updates that are stale and less accurate. The code snippet below demonstrates a sample implementation of this logic.</p> + +<pre> +private static final int TWO_MINUTES = 1000 * 60 * 2; + +/** Determines whether one Location reading is better than the current Location fix + * @param location The new Location that you want to evaluate + * @param currentBestLocation The current Location fix, to which you want to compare the new one + */ +protected boolean isBetterLocation(Location location, Location currentBestLocation) { + if (currentBestLocation == null) { + // A new location is always better than no location + return true; + } + + // Check whether the new location fix is newer or older + long timeDelta = location.getTime() - currentBestLocation.getTime(); + boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; + boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; + boolean isNewer = timeDelta > 0; + + // If it's been more than two minutes since the current location, use the new location + // because the user has likely moved + if (isSignificantlyNewer) { + return true; + // If the new location is more than two minutes older, it must be worse + } else if (isSignificantlyOlder) { + return false; + } + + // Check whether the new location fix is more or less accurate + int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy()); + boolean isLessAccurate = accuracyDelta > 0; + boolean isMoreAccurate = accuracyDelta < 0; + boolean isSignificantlyLessAccurate = accuracyDelta > 200; + + // Check if the old and new location are from the same provider + boolean isFromSameProvider = isSameProvider(location.getProvider(), + currentBestLocation.getProvider()); + + // Determine location quality using a combination of timeliness and accuracy + if (isMoreAccurate) { + return true; + } else if (isNewer && !isLessAccurate) { + return true; + } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { + return true; + } + return false; +} + +/** Checks whether two providers are the same */ +private boolean isSameProvider(String provider1, String provider2) { + if (provider1 == null) { + return provider2 == null; + } + return provider1.equals(provider2); +} +</pre> + +<h2 id="TaskGetLastKnownLocation">Use getLastKnownLocation() Wisely</h2> + +<p>The setup time for getting a reasonable location fix may not be acceptable for certain applications. You should consider calling the {@link android.location.LocationManager#getLastKnownLocation(java.lang.String) getLastKnownLocation()} method which simply queries Android for the last location update previously received by any location providers. Keep in mind that the returned location may be stale. You should check the timestamp and accuracy of the returned location and decide whether it is useful for your application. If you elect to discard the location update returned from {@link android.location.LocationManager#getLastKnownLocation(java.lang.String) getLastKnownLocation()} and wait for fresh updates from the location provider(s), you should consider displaying an appropriate message before location data is received.</p> + +<h2 id="TaskTerminateUpdates">Terminate Location Updates</h2> + +<p>When you are done with using location data, you should terminate location update to reduce unnecessary consumption of power and network bandwidth. For example, if the user navigates away from an activity where location updates are displayed, you should stop location update by calling {@link android.location.LocationManager#removeUpdates(android.location.LocationListener) removeUpdates()} in {@link android.app.Activity#onStop()}. ({@link android.app.Activity#onStop()} is called when the activity is no longer visible. If you want to learn more about activity lifecycle, read up on the <a href="/training/basic-activity-lifecycle/stopping.html">Starting and Stopping an Activity</a> lesson.</p> + +<pre> +protected void onStop() { + super.onStop(); + mLocationManager.removeUpdates(listener); +} +</pre> + +<p class="note"><strong>Note:</strong> For applications that need to continuously receive and process location updates like a near-real time mapping application, it is best to incorporate the location update logic in a background service and make use of the system notification bar to make the user aware that location data is being used.</p>
\ No newline at end of file diff --git a/docs/html/training/location/geocoding.jd b/docs/html/training/location/geocoding.jd new file mode 100644 index 000000000000..6364976985d2 --- /dev/null +++ b/docs/html/training/location/geocoding.jd @@ -0,0 +1,98 @@ +page.title=Displaying the Location Address +parent.title=Making Your App Location Aware +parent.link=index.html + +trainingnavtop=true +previous.title=Obtaining the Current Location +previous.link=currentlocation.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="geocoding.html#TaskReverseGeocoding">Perform Reverse Geocoding</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> +<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download + the sample app</a> +<p class="filename">LocationAware.zip</p> +</div> + +</div> +</div> + +<p>As shown in previous lessons, location updates are received in the form of latitude and longitude coordinates. While this format is useful for calculating distance or displaying a pushpin on a map, the decimal numbers make no sense to most end users. If you need to display a location to user, it is much more preferable to display the address instead.</p> + +<h2 id="TaskReverseGeocoding">Perform Reverse Geocoding</h2> + +<p>Reverse-geocoding is the process of translating latitude longitude coordinates to a human-readable address. The {@link android.location.Geocoder} API is available for this purpose. Note that behind the scene, the API is dependent on a web service. If such service is unavailable on the device, the API will throw a "Service not Available exception" or return an empty list of addresses. A helper method called {@link android.location.Geocoder#isPresent()} was added in Android 2.3 (API level 9) to check for the existence of the service.</p> + +<p>The following code snippet demonstrates the use of the {@link android.location.Geocoder} API to perform reverse-geocoding. Since the {@link android.location.Geocoder#getFromLocation(double, double, int) getFromLocation()} method is synchronous, you should not invoke it from the UI thread, hence an {@link android.os.AsyncTask} is used in the snippet.</p> + +<pre> +private final LocationListener listener = new LocationListener() { + + public void onLocationChanged(Location location) { + // Bypass reverse-geocoding if the Geocoder service is not available on the + // device. The isPresent() convenient method is only available on Gingerbread or above. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && Geocoder.isPresent()) { + // Since the geocoding API is synchronous and may take a while. You don't want to lock + // up the UI thread. Invoking reverse geocoding in an AsyncTask. + (new ReverseGeocodingTask(this)).execute(new Location[] {location}); + } + } + ... +}; + +// AsyncTask encapsulating the reverse-geocoding API. Since the geocoder API is blocked, +// we do not want to invoke it from the UI thread. +private class ReverseGeocodingTask extends AsyncTask<Location, Void, Void> { + Context mContext; + + public ReverseGeocodingTask(Context context) { + super(); + mContext = context; + } + + @Override + protected Void doInBackground(Location... params) { + Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); + + Location loc = params[0]; + List<Address> addresses = null; + try { + // Call the synchronous getFromLocation() method by passing in the lat/long values. + addresses = geocoder.getFromLocation(loc.getLatitude(), loc.getLongitude(), 1); + } catch (IOException e) { + e.printStackTrace(); + // Update UI field with the exception. + Message.obtain(mHandler, UPDATE_ADDRESS, e.toString()).sendToTarget(); + } + if (addresses != null &s;&s; addresses.size() > 0) { + Address address = addresses.get(0); + // Format the first line of address (if available), city, and country name. + String addressText = String.format("%s, %s, %s", + address.getMaxAddressLineIndex() > 0 ? address.getAddressLine(0) : "", + address.getLocality(), + address.getCountryName()); + // Update the UI via a message handler. + Message.obtain(mHandler, UPDATE_ADDRESS, addressText).sendToTarget(); + } + return null; + } +} +</pre>
\ No newline at end of file diff --git a/docs/html/training/location/index.jd b/docs/html/training/location/index.jd new file mode 100644 index 000000000000..48cfbc3c5857 --- /dev/null +++ b/docs/html/training/location/index.jd @@ -0,0 +1,51 @@ +page.title=Making Your App Location Aware + +trainingnavtop=true +startpage=true +next.title=Using the Location Manager +next.link=locationmanager.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>Dependencies and prerequisites</h2> + +<ul> + <li>Android 1.0 or higher (2.3+ for the sample app)</li> +</ul> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> +<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download + the sample app</a> +<p class="filename">LocationAware.zip</p> +</div> + +</div> +</div> + +<p>Users bring their mobile devices with them almost everywhere. One of the unique features available to mobile applications is location awareness. Knowing the location and using the information wisely can bring a more contextual experience to your users.</p> + +<p>This class teaches you how to incorporate location based services in your Android application. You'll learn a number of methods to receive location updates and related best practices.</p> + +<h2>Lessons</h2> + +<dl> + <dt><b><a href="locationmanager.html">Using the Location Manager</a></b></dt> + <dd>Learn how to set up your application before it can receive location updates in Android.</dd> + + <dt><b><a href="currentlocation.html">Obtaining the Current Location</a></b></dt> + <dd>Learn how to work with underlying location technologies available on the platform to obtain current location.</dd> + + <dt><b><a href="geocoding.html">Displaying a Location Address</a></b></dt> + <dd>Learn how to translate location coordinates into addresses that are readable to users.</dd> +</dl> diff --git a/docs/html/training/location/locationmanager.jd b/docs/html/training/location/locationmanager.jd new file mode 100644 index 000000000000..5da120595f10 --- /dev/null +++ b/docs/html/training/location/locationmanager.jd @@ -0,0 +1,90 @@ +page.title=Using the Location Manager +parent.title=Making Your App Location Aware +parent.link=index.html + +trainingnavtop=true +next.title=Obtaining the Current Location +next.link=currentlocation.html + +@jd:body + + +<!-- This is the training bar --> +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="locationmanager.html#TaskDeclarePermissions">Declare Proper Permissions in Android Manifest</a></li> + <li><a href="locationmanager.html#TaskGetLocationManagerRef">Get a Reference to LocationManager</a></li> + <li><a href="locationmanager.html#TaskPickLocationProvider">Pick a Location Provider</a></li> +</ol> + +<h2>You should also read</h2> + +<ul> + <li><a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a></li> +</ul> + +<h2>Try it out</h2> + +<div class="download-box"> +<a href="http://developer.android.com/shareables/training/LocationAware.zip" class="button">Download + the sample app</a> +<p class="filename">LocationAware.zip</p> +</div> + +</div> +</div> + +<p>Before your application can begin receiving location updates, it needs to perform some simple steps to set up access. In this lesson, you'll learn what these steps entail.</p> + +<h2 id="TaskDeclarePermissions">Declare Proper Permissions in Android Manifest</h2> + +<p>The first step of setting up location update access is to declare proper permissions in the manifest. If permissions are missing, the application will get a {@link java.lang.SecurityException} at runtime.</p> + +<p>Depending on the {@link android.location.LocationManager} methods used, either {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} or {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission is needed. For example, you need to declare the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} permission if your application uses a network-based location provider only. The more accurate GPS requires the {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission. +Note that declaring the {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permission implies {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} already.</p> + +<p>Also, if a network-based location provider is used in the application, you'll need to declare the internet permission as well.</p> + +<pre> +<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> +<uses-permission android:name="android.permission.INTERNET" /> +</pre> + +<h2 id="TaskGetLocationManagerRef">Get a Reference to LocationManager</h2> + +<p>{@link android.location.LocationManager} is the main class through which your application can access location services on Android. Similar to other system services, a reference can be obtained from calling the {@link android.content.Context#getSystemService(java.lang.String) getSystemService()} method. If your application intends to receive location updates in the foreground (within an {@link android.app.Activity}), you should usually perform this step in the {@link android.app.Activity#onCreate(android.os.Bundle) onCreate()} method.</p> + +<pre> +LocationManager locationManager = + (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); +</pre> + +<h2 id="TaskPickLocationProvider">Pick a Location Provider</h2> + +<p>While not required, most modern Android-powered devices can receive location updates through multiple underlying technologies, which are abstracted to an application as {@link android.location.LocationProvider} objects. Location providers may have different performance characteristics in terms of time-to-fix, accuracy, monetary cost, power consumption, and so on. Generally, a location provider with a greater accuracy, like the GPS, requires a longer fix time than a less accurate one, such as a network-based location provider.</p> + +<p>Depending on your application's use case, you have to choose a specific location provider, or multiple providers, based on similar tradeoffs. For example, a points of interest check-in application would require higher location accuracy than say, a retail store locator where a city level location fix would suffice. The snippet below asks for a provider backed by the GPS.</p> + +<pre> +LocationProvider provider = + locationManager.getProvider(LocationManager.GPS_PROVIDER); +</pre> + +<p>Alternatively, you can provide some input criteria such as accuracy, power requirement, monetary cost, and so on, and let Android decide a closest match location provider. The snippet below asks for a location provider with fine accuracy and no monetary cost. Note that the criteria may not resolve to any providers, in which case a null will be returned. Your application should be prepared to gracefully handle the situation.</p> + +<pre> +// Retrieve a list of location providers that have fine accuracy, no monetary cost, etc +Criteria criteria = new Criteria(); +criteria.setAccuracy(Criteria.ACCURACY_FINE); +criteria.setCostAllowed(false); +... +String providerName = locManager.getBestProvider(criteria, true); + +// If no suitable provider is found, null is returned. +if (providerName != null) { + ... +} +</pre> |