diff options
74 files changed, 2384 insertions, 577 deletions
@@ -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/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd index cc98f8f..bc7d83b 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 c43962a..fd90b1a 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 a7d00f3..64651a1 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 e70a0bb..412bd91 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 63e67cd..b16e466 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 e48a5ae..d473e85 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 a67012f..295a720 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 3d831f3..5e9f686 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 3fa37d8..ec87de8 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -273,13 +273,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> @@ -301,7 +301,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"> @@ -332,7 +331,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> @@ -346,7 +344,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> @@ -387,7 +385,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> @@ -395,7 +393,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"> @@ -802,7 +800,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> diff --git a/docs/html/guide/market/billing/billing_integrate.jd b/docs/html/guide/market/billing/billing_integrate.jd index b49dc25..4b3650f 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 05a3a40..e7e23f8 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 41e3bc4..0de7819 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/optimizing-for-3.0.jd b/docs/html/guide/practices/optimizing-for-3.0.jd index 140c50c..d6c621e 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 29dff26..a870b22 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 e86ec30..5bd9be55 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 5f98902..8a2e9cd 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 9175566..5f0a501 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/tutorials/views/hello-mapview.jd b/docs/html/guide/tutorials/views/hello-mapview.jd index 458db4f..5217b6b 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/efficient-downloads/DDMS.png b/docs/html/images/efficient-downloads/DDMS.png Binary files differnew file mode 100644 index 0000000..e7b0b94 --- /dev/null +++ b/docs/html/images/efficient-downloads/DDMS.png diff --git a/docs/html/images/efficient-downloads/graphs.png b/docs/html/images/efficient-downloads/graphs.png Binary files differnew file mode 100644 index 0000000..65faeaa --- /dev/null +++ b/docs/html/images/efficient-downloads/graphs.png diff --git a/docs/html/images/efficient-downloads/mobile_radio_state_machine.png b/docs/html/images/efficient-downloads/mobile_radio_state_machine.png Binary files differnew file mode 100644 index 0000000..e06608b --- /dev/null +++ b/docs/html/images/efficient-downloads/mobile_radio_state_machine.png diff --git a/docs/html/images/screens_support/avds-config.png b/docs/html/images/screens_support/avds-config.png Binary files differindex 3af1c39..c7d534c 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 787a655..d3203bb 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 5f8e37ce..edd8eb0 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/creating-input-method.jd b/docs/html/resources/articles/creating-input-method.jd index e4b77f4..84c2704 100644 --- a/docs/html/resources/articles/creating-input-method.jd +++ b/docs/html/resources/articles/creating-input-method.jd @@ -3,248 +3,526 @@ parent.title=Articles parent.link=../browser.html?tag=article @jd:body - <div id="qv-wrapper"> <div id="qv"> - - <h2>See also</h2> - <ol> - <li><a href="{@docRoot}resources/articles/on-screen-inputs.html">Onscreen Input Methods</a></li> - <li><a href="{@docRoot}resources/samples/SoftKeyboard/index.html">Soft Keyboard sample</a></li> - </ol> - +<h2>See also</h2> +<ol> + <li> + <a href="{@docRoot}resources/articles/on-screen-inputs.html">Onscreen Input Methods</a> + </li> + <li> + <a href="{@docRoot}resources/samples/SoftKeyboard/index.html">Soft Keyboard sample</a> + </li> +</ol> </div> </div> - - -<p>To create an input method (IME) for entering text into text fields -and other Views, you need to extend the {@link android.inputmethodservice.InputMethodService}. -class. This class provides much of the basic implementation for an input -method, in terms of managing the state and visibility of the input method and -communicating with the currently visible activity.</p> - -<p>A good starting point would be the SoftKeyboard sample code provided as part -of the SDK. You can modify the sample code to start building your own input -method.</p> - -<p>An input method is packaged like any other application or service. In the -<code>AndroidManifest.xml</code> file, you declare the input method as a -service, with the appropriate intent filter and any associated meta data:</p> - -<pre><manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.fastinput"> - - <application android:label="@string/app_label"><br> - <!-- Declares the input method service --> - <service android:name="FastInputIME" - android:label="@string/fast_input_label" - android:permission="android.permission.BIND_INPUT_METHOD"> - <intent-filter> - <action android:name="android.view.InputMethod" /> - </intent-filter> - <meta-data android:name="android.view.im" android:resource="@xml/method" /> - </service> - - <!-- Optional activities. A good idea to have some user settings. --> - <activity android:name="FastInputIMESettings" android:label="@string/fast_input_settings"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - </intent-filter> - </activity> - </application> -</manifest></pre> - -<p>If your input method allows the user to tweak some settings, you should -provide a settings activity that can be launched from the Settings application. -This is optional and you may choose to provide all user settings directly in -your IME's UI.</p> - -<p>The typical life-cycle of an <code>InputMethodService</code> looks like -this:</p> - -<p><img src="images/ime_003.png" style="border: medium none ; width: 374px; height: 871px;"></p> - -<h3>Visual Elements</h3> - -<p>There are two main visual elements for an input method—the input view and the -candidates view. You don't have to follow this style though, if one of them is -not relevant to your input method experience.</p> - -<h4>Input View</h4> - -<p>This is where the user can input text either in the form of keypresses, -handwriting or other gestures. When the input method is displayed for the first -time, <code>InputMethodService.onCreateInputView()</code> will be called. Create -and return the view hierarchy that you would like to display in the input method -window.</p> - -<h4>Candidates View</h4> - -<p>This is where potential word corrections or completions are presented to the -user for selection. Again, this may or may not be relevant to your input method -and you can return <code>null</code> from calls to -<code>InputMethodService.onCreateCandidatesView()</code>, which is the default -behavior.</p> - -<h3>Designing for the different Input Types</h3> - -<p>An application's text fields can have different input types specified on -them, such as free form text, numeric, URL, email address and search. When you -implement a new input method, you need to be aware of the different input types. -Input methods are not automatically switched for different input types and so -you need to support all types in your IME. However, the IME is not responsible -for validating the input sent to the application. That's the responsibility of -the application.</p> - -<p>For example, the LatinIME provided with the Android platform provides -different layouts for text and phone number entry:</p> - -<p><img style="margin: 0pt 10px 0pt 0pt; width: 319px; height: 198px;" src="images/ime_002.png"><img style="width: 320px; height: 199px;" src="images/ime.png"></p> - -<p><code>InputMethodService.onStartInputView()</code> is called with an<code> -EditorInfo</code> object that contains details about the input type and other -attributes of the application's text field.</p><p>(<code>EditorInfo.inputType -& EditorInfo.TYPE_CLASS_MASK</code>) can be one of many different values, -including:</p> - +<p> + An input method editor (IME) is a user control that enables users to enter text. Android + provides an extensible input method framework that allows applications to provide users + alternative input methods, such as on-screen keyboards or even speech input. Once installed, + users can select which IME they want to use from the system settings and use it across the + entire system; only one IME may be enabled at a time. +</p> +<p> + To add an IME to the Android system, you create an Android application + containing a class that extends {@link android.inputmethodservice.InputMethodService}. In + addition, you usually create a "settings" activity that passes options to the IME + service. You can also define a settings UI that's displayed as part of the system settings. +</p> +<p>This article covers the following:</p> <ul> -<li><code>TYPE_CLASS_NUMBER</code></li> -<li><code>TYPE_CLASS_DATETIME</code></li> -<li><code>TYPE_CLASS_PHONE</code></li> -<li><code>TYPE_CLASS_TEXT</code></li> + <li>The IME lifecycle.</li> + <li>Declaring IME components in the application manifest.</li> + <li>The IME API.</li> + <li>Designing an IME UI.</li> + <li>Sending text from an IME to an application.</li> + <li>Working with IME subtypes.</li> </ul> +<p> + If you haven't worked with IMEs before, you should read the introductory article + <a href="{@docRoot}resources/articles/on-screen-inputs.html">Onscreen Input Methods</a> first. + Also, the Soft Keyboard sample app included in the SDK contains sample code that you can modify + to start building your own IME. +</p> +<h2 id="InputMethodLifecycle">The IME Lifecycle</h2> +<p> + The following diagram describes the life cycle of an IME: +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_lifecycle_image.png" alt="" height="845" + id="figure1" /> +<p class="img-caption"> + <strong>Figure 1.</strong> The life cycle of an IME. +</p> +<p> + The following sections describe how to implement the UI and code associated with an IME that + follows this lifecycle. +</p> +<h2 id="DefiningIME">Declaring IME Components in the Manifest</h2> +<p> + In the Android system, an IME is an Android application that contains a special IME service. + The application's manifest file must declare the service, request the necessary permissions, + provide an intent filter that matches the action <code>action.view.InputMethod</code>, and + provide metadata that defines characteristics of the IME. In addition, to provide a settings + interface that allows the user to modify the behavior of the IME, you can define a "settings" + activity that can be launched from System Settings. +</p> +<p> + The following snippet declares IME service. It requests the permission {@link + android.Manifest.permission#BIND_INPUT_METHOD} to allow the service to connect the IME to + the system, sets up an intent filter that matches the action + <code>android.view.InputMethod</code>, and defines metadata for the IME: +</p> +<pre> +<!-- Declares the input method service --> + <service android:name="FastInputIME" + android:label="@string/fast_input_label" + android:permission="android.permission.BIND_INPUT_METHOD"> + <intent-filter> + <action android:name="android.view.InputMethod" /> + </intent-filter> + <meta-data android:name="android.view.im" android:resource="@xml/method" /> + </service> +</pre> +<p> + This next snippet declares the settings activity for the IME. It has an intent filter for + {@link android.content.Intent#ACTION_MAIN} that indicates this activity is the main entry point + for the IME application:</p> +<pre> + <!-- Optional: an activity for controlling the IME settings --> + <activity android:name="FastInputIMESettings" + android:label="@string/fast_input_settings"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + </intent-filter> + </activity> +</pre> +<p> + You can also provide access to the IME's settings directly from its UI. +</p> +<h2 id="IMEAPI">The Input Method API</h2> +<p> + Classes specific to IMEs are found in the {@link android.inputmethodservice} and {@link + android.view.inputmethod} packages. The {@link android.view.KeyEvent} class is important for + handling keyboard characters. +</p> +<p> + The central part of an IME is a service component, a class that extends + {@link android.inputmethodservice.InputMethodService}. In addition to implementing the + normal service lifecycle, this class has callbacks for providing your IME's UI, handling user + input, and delivering text to the field that currently has focus. By default, the + {@link android.inputmethodservice.InputMethodService} class provides most of the implementation + for managing the state and visibility of the IME and communicating with the current + input field. +</p> +<p> + The following classes are also important: +</p> +<dl> + <dt>{@link android.view.inputmethod.BaseInputConnection}</dt> + <dd> + Defines the communication channel from an {@link android.view.inputmethod.InputMethod} + back to the application that is receiving its input. You use it to read text around the + cursor, commit text to the text box, and send raw key events to the application. + Applications should extend this class rather than implementing the base interface + {@link android.view.inputmethod.InputConnection}. + </dd> + <dt>{@link android.inputmethodservice.KeyboardView}</dt> + <dd> + An extension of {@link android.view.View} that renders a keyboard and responds to user + input events. The keyboard layout is specified by an instance of + {@link android.inputmethodservice.Keyboard}, which you can define in an XML file. + </dd> +</dl> +<h2 id="IMEUI">Designing the Input Method UI</h2> +<p> + There are two main visual elements for an IME: the <strong>input</strong> view and the + <strong>candidates</strong> view. You only have to implement the elements that are relevant to + the input method you're designing. +</p> +<h3 id="InputView">Input view</h3> +<p> + The input view is the UI where the user inputs text, in the form of keyclicks, handwriting or + gestures. When the iIME is displayed for the first time, the system calls the + {@link android.inputmethodservice.InputMethodService#onCreateInputView()} callback. In your + implementation of this method, you create the layout you want to display in the IME + window and return the layout to the system. This snippet is an example of implementing the + {@link android.inputmethodservice.InputMethodService#onCreateInputView()} method: +<pre> + @Override + public View onCreateInputView() { + MyKeyboardView inputView = + (MyKeyboardView) getLayoutInflater().inflate( R.layout.input, null); + + inputView.setOnKeyboardActionListener(this); inputView.setKeyboard(mLatinKeyboard); + + return mInputView; + } +</pre> +<p> + In this example, {@code MyKeyboardView} is an instance of a custom implementation of + {@link android.inputmethodservice.KeyboardView} that renders a + {@link android.inputmethodservice.Keyboard}. If you’re building a traditional QWERTY keyboard, + see the <a href=”{@docRoot}resources/samples/SoftKeyboard/index.html”>Soft Keyboard</a> sample + app for an example of how to extend the {@link android.inputmethodservice.KeyboardView} class. +</p> +<h3 id="CandidateView">Candidates view</h3> +<p> + The candidates view is the UI where the IME displays potential word corrections or + suggestions for the user to select. In the IME lifecycle, the system calls + {@link android.inputmethodservice.InputMethodService#onCreateCandidatesView()} when it's ready + to display the candidate view. In your implementation of this method, return a layout that shows + word suggestions, or return null if you don’t want to show anything (a null response is the + default behavior, so you don’t have to implement this if you don’t provide suggestions).</p> +<p> + For an example implementation that provides user suggestions, see the + <a href=”{@docRoot}resources/samples/SoftKeyboard/index.html”>Soft Keyboard</a> sample app. +</p> +<h3 id="DesignConsiderations">UI design considerations</h3> +<p> + This section describes some specific UI design considerations for IMEs. +</p> +<h4>Handling multiple screen sizes</h4> +<p> + The UI for your IME must be able to scale for different screen sizes, and it also + must handle both landscape and portrait orientations. In non-fullscreen IME mode, leave + sufficient space for the application to show the text field and any associated context, so that + no more than half the screen is occupied by the IME. In fullscreen IME mode this is not an + issue. +</p> +<h4>Handling different input types</h4> +<p> + Android text fields allow you to set a specific input type, such as free form text, numbers, + URLs, email addresses, and search strings. When you implement a new IME, you need to + detect the input type of each field and provide the appropriate interface for it. However, you + don't have to set up your IME to check that the user entered text that's valid for the + input type; that's the responsibility of the application that owns the text field. +</p> +<p> + For example, here are screenshots of the interfaces that the Latin IME provided with the + Android platform provides for text and phone number inputs: +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_text_type_screenshot.png" alt="" + height="142" id="figure2" /> +<img src="{@docRoot}resources/articles/images/inputmethod_numeric_type_screenshot.png" alt="" + height="120" id="figure2a" /> +<p class="img-caption"> + <strong>Figure 2.</strong> Latin IME input types. +</p> +<p> + When an input field receives focus and your IME starts, the system calls + {@link android.inputmethodservice.InputMethodService#onStartInputView(EditorInfo, boolean) + onStartInputView()}, passing in an {@link android.view.inputmethod.EditorInfo} object that + contains details about the input type and other attributes of the text field. In this object, + the {@link android.view.inputmethod.EditorInfo#inputType} field contains the text field's input + type. +</p> +<p> + The {@link android.view.inputmethod.EditorInfo#inputType} field is an <code>int</code> + that contains bit patterns for various input type settings. To test it for the text field's + input type, mask it with the constant {@link android.text.InputType#TYPE_MASK_CLASS}, like + this: +</p> +<pre> +inputType & InputType.TYPE_MASK_CLASS +</pre> +<p> +The input type bit pattern can have one of several values, including: +</p> +<dl> + <dt>{@link android.text.InputType#TYPE_CLASS_NUMBER}</dt> + <dd> + A text field for entering numbers. As illustrated in the previous screen shot, the + Latin IME displays a number pad for fields of this type. + </dd> + <dt>{@link android.text.InputType#TYPE_CLASS_DATETIME}</dt> + <dd> + A text field for entering a date and time. + </dd> + <dt>{@link android.text.InputType#TYPE_CLASS_PHONE}</dt> + <dd> + A text field for entering telephone numbers. + </dd> + <dt>{@link android.text.InputType#TYPE_CLASS_TEXT}</dt> + <dd> + A text field for entering all supported characters. + </dd> +</dl> +<p> + These constants are described in more detail in the reference documentation for + {@link android.text.InputType}. +</p> +<p> + The {@link android.view.inputmethod.EditorInfo#inputType} field can contain other bits that + indicate a variant of the text field type, such as: +</p> +<dl> + <dt>{@link android.text.InputType#TYPE_TEXT_VARIATION_PASSWORD}</dt> + <dd> + A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering passwords. The + input method will display dingbats instead of the actual text. + </dd> + <dt>{@link android.text.InputType#TYPE_TEXT_VARIATION_URI}</dt> + <dd> + A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering web URLs and + other Uniform Resource Identifiers (URIs). + </dd> + <dt>{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_COMPLETE}</dt> + <dd> + A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering text that the + application "auto-completes" from a dictionary, search, or other facility. + </dd> +</dl> +<p> + Remember to mask {@link android.view.inputmethod.EditorInfo#inputType} with the appropriate + constant when you test for these variants. The available mask constants are listed in the + reference documentation for {@link android.text.InputType}. +</p> +<p class="caution"> + <strong>Caution:</strong> In your own IME, make sure you handle text correctly when you send it + to a password field. Hide the password in your UI both in the input view and in the candidates + view. Also remember that you shouldn't store passwords on a device. To learn more, see the <a + href="{@docRoot}guide/practices/security.html">Designing for Security</a> guide. +</p> +<h2 id="SendText">Sending Text to the Application</h2> +<p> + As the user inputs text with your IME, you can send text to the application by + sending individual key events or by editing the text around the cursor in the application's text + field. In either case, you use an instance of {@link android.view.inputmethod.InputConnection} + to deliver the text. To get this instance, call + {@link android.inputmethodservice.InputMethodService#getCurrentInputConnection + InputMethodService.getCurrentInputConnection()}. +</p> +<h3 id="EditingCursor">Editing the text around the cursor</h3> +<p> + When you're handling the editing of existing text in a text field, some of the more useful + methods in {@link android.view.inputmethod.BaseInputConnection} are: +</p> +<dl> + <dt> + {@link android.view.inputmethod.BaseInputConnection#getTextBeforeCursor(int, int) + getTextBeforeCursor()}</dt> + <dd> + Returns a {@link java.lang.CharSequence} containing the number of requested characters + before the current cursor position. + </dd> + <dt> + {@link android.view.inputmethod.BaseInputConnection#getTextAfterCursor(int, int) + getTextAfterCursor()} + </dt> + <dd> + Returns a {@link java.lang.CharSequence} containing the number of requested characters + following the current cursor position. + </dd> + <dt> + {@link android.view.inputmethod.BaseInputConnection#deleteSurroundingText(int, int) + deleteSurroundingText()} + </dt> + <dd> + Deletes the specified number of characters before and following the current cursor + position. + </dd> + <dt> + {@link android.view.inputmethod.BaseInputConnection#commitText(CharSequence, int) + commitText()} + </dt> + <dd> + Commit a {@link java.lang.CharSequence} to the text field and set a new cursor + position. + </dd> +</dl> +<p> + For example, the following snippet shows how to replace the text "Fell" to the left of the + with the text "Hello!": +</p> +<pre> + InputConnection ic = getCurrentInputConnection(); + + ic.deleteSurroundingText(4, 0); + + ic.commitText("Hello", 1); + + ic.commitText("!", 1); +</pre> +<h3 id="ComposeThenCommit">Composing text before committing</h3> +<p> + If your IME does text prediction or requires multiple steps to compose a glyph or + word, you can show the progress in the text field until the user commits the word, and then you + can replace the partial composition with the completed text. You may give special treatment to + the text by adding a "span" to it when you pass it to InputConnection#setComposingText(). +</p> +<p> + The following snippet shows how to show progress in a text field: +</p> +<pre> + InputConnection ic = getCurrentInputConnection(); + + ic.setComposingText("Composi", 1); +... -<p>See <code>android.text.InputType</code> for more details.</p> - -<p><code>EditorInfo.inputType</code> can contain other masked bits that -indicate the class variation and other flags. For example, -<code>TYPE_TEXT_VARIATION_PASSWORD</code> or <code>TYPE_TEXT_VARIATION_URI</code> -or <code>TYPE_TEXT_FLAG_AUTO_COMPLETE</code>.</p> - -<h4>Password fields</h4> - -<p>Pay -specific attention when sending text to password fields. Make sure that -the password is not visible within your UI — neither in the input -view or the candidates view. Also, do not save the password anywhere without -explicitly informing the user.</p> - -<h3>Landscape vs. portrait</h3> - -<p>The UI needs to be able to scale between landscape and portrait orientations. -In non-fullscreen IME mode, leave sufficient space for the application to show -the text field and any associated context. Preferably, no more than half the -screen should be occupied by the IME. In fullscreen IME mode this is not an -issue.</p> - -<h3>Sending text to the application</h3> - -<p>There are two ways to send text to the application. You can either send -individual key events or you can edit the text around the cursor in the -application's text field.</p> - -<p>To send a key event, you can simply construct KeyEvent objects and call -<code>InputConnection.sendKeyEvent()</code>. Here are some examples:</p> - -<pre>InputConnection ic = getCurrentInputConnection(); -long eventTime = SystemClock.uptimeMillis(); -ic.sendKeyEvent(new KeyEvent(eventTime, eventTime, - KeyEvent.ACTION_DOWN, keyEventCode, 0, 0, 0, 0, - KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE)); -ic.sendKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), eventTime, - KeyEvent.ACTION_UP, keyEventCode, 0, 0, 0, 0, - KeyEvent.FLAG_SOFT_KEYBOARD|KeyEvent.FLAG_KEEP_TOUCH_MODE));</pre> - -<p>Or use the convenience method:</p> - -<pre>InputMethodService.sendDownUpKeyEvents(keyEventCode);</pre> - -<p class="note"><strong>Note</strong>: -It is recommended to use the above method for certain fields such as -phone number fields because of filters that may be applied to the text -after each key press. Return key and delete key should also be sent as -raw key events for certain input types, as applications may be watching -for specific key events in order to perform an action.</p> + ic.setComposingText("Composin", 1); -<p>When editing text in a text field, some of the more useful methods on -<code>android.view.inputmethod.InputConnection</code> are:</p> +... + ic.commitText("Composing ", 1); +</pre> +<p> + The following screenshots show how this appears to the user: +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_composing_text_1.png" alt="" height="54" + id="figure3a" /> +<img src="{@docRoot}resources/articles/images/inputmethod_composing_text_2.png" alt="" height="53" + id="figure3b" /> +<img src="{@docRoot}resources/articles/images/inputmethod_composing_text_3.png" alt="" height="31" + id="figure3c" /> +<p class="img-caption"> + <strong>Figure 3.</strong> Composing text before committing. +</p> +<h3 id="HardwareKeyEvents">Intercepting hardware key events</h3> +<p> + Even though the input method window doesn't have explicit focus, it receives hardware key + events first and can choose to consume them or forward them along to the application. For + example, you may want to consume the directional keys to navigate within your UI for candidate + selection during composition. You may also want to trap the back key to dismiss any popups + originating from the input method window.</p> +<p> + To intercept hardware keys, override + {@link android.inputmethodservice.InputMethodService#onKeyDown(int, KeyEvent) onKeyDown()} + and {@link android.inputmethodservice.InputMethodService#onKeyUp(int, KeyEvent) onKeyUp()}. + See the <a href=”{@docRoot}resources/samples/SoftKeyboard/index.html”>Soft Keyboard</a> sample + app for an example. +</p> +<p> + Remember to call the <code>super()</code> method for keys you don't want to handle yourself. +</p> +<h2 id="IMESubTypes">Creating an IME Subtype</h2> +<p> + Subtypes allow the IME to expose multiple input modes and languages supported by an IME. A + subtype can represent: +</p> <ul> -<li><code>getTextBeforeCursor()</code></li> -<li><code>getTextAfterCursor()</code></li> -<li><code>deleteSurroundingText()</code></li> -<li><code>commitText()</code></li> + <li>A locale such as en_US or fr_FR</li> + <li>An input mode such as voice, keyboard, or handwriting</li> + <li> + Other input styles, forms, or properties specific to the IME, such as 10-key or qwerty + keyboard layouts. + </li> </ul> - -<p>For example, let's say the text "Fell" is to the left of the cursor -and you want to replace it with "Hello!":</p> - -<pre>InputConnection ic = getCurrentInputConnection(); -ic.deleteSurroundingText(4, 0); -ic.commitText("Hello", 1); -ic.commitText("!", 1);</pre> - -<h4>Composing text before committing</h4> - -<p>If your input method does some kind of text prediction or requires multiple -steps to compose a word or glyph, you can show the progress in the text field -until the user commits the word and then you can replace the partial composition -with the completed text. The text that is being composed will be highlighted in -the text field in some fashion, such as an underline.</p> - -<pre>InputConnection ic = getCurrentInputConnection(); -ic.setComposingText("Composi", 1); -... -ic.setComposingText("Composin", 1); -... -ic.commitText("Composing ", 1);</pre> - -<p><img style="width: 320px; height: 98px; margin-bottom: 10px;" src="images/ime_006.png"> -<img style="width: 320px; height: 97px; margin-bottom: 10px;" src="images/ime_005.png"> -<img style="width: 320px; height: 97px;" src="images/ime_004.png"></p> - -<h3>Intercepting hard key events</h3> - -<p>Even though the input method window doesn't have explicit focus, it receives -hard key events first and can choose to consume them or forward them along to -the application. For instance, you may want to consume the directional keys to -navigate within your UI for candidate selection during composition. Or you may -want to trap the back key to dismiss any popups originating from the input -method window. To intercept hard keys, override -<code>InputMethodService.onKeyDown()</code> and -<code>InputMethodService.onKeyUp().</code> Remember to call -<code>super.onKey</code>* if you don't want to consume a certain key -yourself.</p> - -<h3>Other considerations</h3> - +<p> + Basically, the mode can be any text such as "keyboard", "voice", and so forth. +</p> +<p>A subtype can also expose a combination of these.</p> +<p> + Subtype information is used for an IME switcher dialog that's available from the notification + bar and also for IME settings. The information also allows the framework to bring up a + specific subtype of an IME directly. When you build an IME, use the subtype facility, because + it helps the user identify and switch between different IME languages and modes. +</p> +<p> + You define subtypes in one of the input method's XML resource files, using the + <code><subtype></code> element. The following snippet defines an IME with two + subtypes: a keyboard subtype for the US English locale, and another keyboard subtype for the + French language locale for France: +</p> +<pre> +<input-method xmlns:android="http://schemas.android.com/apk/res/android" + android:settingsActivity="com.example.softkeyboard.Settings" + android:icon="@drawable/ime_icon" + <subtype android:name="@string/display_name_english_keyboard_ime" + android:icon="@drawable/subtype_icon_english_keyboard_ime" + android:imeSubtypeLanguage="en_US" + android:imeSubtypeMode="keyboard" + android:imeSubtypeExtraValue="somePrivateOption=true" + /> + <subtype android:name="@string/display_name_french_keyboard_ime" + android:icon="@drawable/subtype_icon_french_keyboard_ime" + android:imeSubtypeLanguage="fr_FR" + android:imeSubtypeMode="keyboard" + android:imeSubtypeExtraValue="foobar=30,someInternalOption=false" + /> + <subtype android:name="@string/display_name_german_keyboard_ime" + ... + /> +/> +</pre> +<p> + To ensure that your subtypes are labeled correctly in the UI, use %s to get a subtype label + that is the same as the subtype’s locale label. This is demonstrated in the next two snippets. + The first snippet shows part of the input method's XML file: +</p> +<pre> + <subtype + android:label="@string/label_subtype_generic" + android:imeSubtypeLocale="en_US" + android:icon="@drawable/icon_en_us" + android:imeSubtypeMode="keyboard" /> +</pre> +<p> + The next snippet is part of the IME's <code>strings.xml</code> file. The string + resource <code>label_subtype_generic</code>, which is used by the input method UI definition to + set the subtype's label, is defined as: +</p> +<pre> +<string name="label_subtype_generic">%s</string> +</pre> +<p> + This sets the subtype’s display name to “English (United States)” in any English language + locale, or to the appropriate localization in other locales. +</p> +<h3 id="SubtypeProcessing">Choosing IME subtypes from the notification bar</h3> +<p> + The Android system manages all subtypes exposed by all IMEs. IME subtypes are + treated as modes of the IME they belong to. In the notification bar, a user can select an + available subtype for the currently-set IME, as shown in the following screenshot: +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_subtype_notification.png" alt="" + height="85" id="figure4" /> +<p class="img-caption"> + <strong>Figure 4.</strong> Choosing an IME subtype from the notification bar. +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_subtype_preferences.png" alt="" + height="165" id="figure5" /> +<p class="img-caption"> + <strong>Figure 5.</strong> Setting subtype preferences in System Settings. +</p> +<h3 id="SubtypeSettings">Choosing IME subtypes from System Settings</h3> +<p> + A user can control how subtypes are used in the “Language & input” settings panel in the + System Settings area. In the Soft Keyboard sample, the file + <code>InputMethodSettingsFragment.java</code> contains an implementation that + facilitates a subtype enabler in the IME settings. Please refer to the SoftKeyboard sample in + the Android SDK for more information about how to support Input Method Subtypes in your IME. +</p> +<img src="{@docRoot}resources/articles/images/inputmethod_subtype_settings.png" alt="" + height="210" id="figure6" /> +<p class="img-caption"> + <strong>Figure 6.</strong> Choosing a language for the IME. +</p> +<h2 id="GeneralDesign">General IME Considerations</h2> +<p> + Here are some other things to consider as you're implementing your IME: +</p> <ul> -<li>Provide a way for the user to easily bring up any associated settings -directly from the input method UI</li> -<li>Provide -a way for the user to switch to a different input method (multiple -input methods may be installed) directly from the input method UI.</li> -<li>Bring -up the UI quickly - preload or lazy-load any large resources so that -the user sees the input method quickly on tapping on a text field. And -cache any resources and views for subsequent invocations of the input -method.</li> -<li>On the flip side, any large memory allocations should -be released soon after the input method window is hidden so that -applications can have sufficient memory to run. Consider using a -delayed message to release resources if the input method is in a hidden -state for a few seconds.</li> -<li>Make sure that most common characters -can be entered using the input method, as users may use punctuation in -passwords or user names and they shouldn't be stuck in a situation -where they can't enter a certain character in order to gain access into -a password-locked device.</li> +<li> + Provide a way for users to set options directly from the IME's UI. +</li> +<li> + Because multiple IMEs may be installed on the device, provide a way for the user to switch to a + different IME directly from the input method UI. +</li> +<li> + Bring up the IME's UI quickly. Preload or load on demand any large resources so that users + see the IME as soon as they tap on a text field. Cache resources and views for subsequent + invocations of the input method. +</li> +<li> + Conversely, you should release large memory allocations soon after the input method window is + hidden, so that applications can have sufficient memory to run. Consider using a delayed message + to release resources if the IME is in a hidden state for a few seconds. +</li> +<li> + Make sure that users can enter as many characters as possible for the language or locale + associated with the IME. Remember that users may use punctuation in passwords or user + names, so your IME has to provide many different characters to allow users to enter a + password and get access to the device. +</li> </ul> - -<h3>Samples</h3> - -<p>For a real world example, with support for multiple input types and text -prediction, see the <a id="ccpb" -href="http://android.git.kernel.org/?p=platform/packages/inputmethods/LatinIME. -git;a=tree" title="LatinIME source code online">LatinIME source code</a>. The -Android SDK also includes a SoftKeyboard sample as well.</p> diff --git a/docs/html/resources/articles/images/inputmethod_composing_text_1.png b/docs/html/resources/articles/images/inputmethod_composing_text_1.png Binary files differnew file mode 100644 index 0000000..3403489 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_composing_text_1.png diff --git a/docs/html/resources/articles/images/inputmethod_composing_text_2.png b/docs/html/resources/articles/images/inputmethod_composing_text_2.png Binary files differnew file mode 100644 index 0000000..67bd1d9 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_composing_text_2.png diff --git a/docs/html/resources/articles/images/inputmethod_composing_text_3.png b/docs/html/resources/articles/images/inputmethod_composing_text_3.png Binary files differnew file mode 100644 index 0000000..4fd1a30 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_composing_text_3.png diff --git a/docs/html/resources/articles/images/inputmethod_lifecycle_image.png b/docs/html/resources/articles/images/inputmethod_lifecycle_image.png Binary files differnew file mode 100644 index 0000000..5f7cf95 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_lifecycle_image.png diff --git a/docs/html/resources/articles/images/inputmethod_numeric_type_screenshot.png b/docs/html/resources/articles/images/inputmethod_numeric_type_screenshot.png Binary files differnew file mode 100644 index 0000000..61b7483 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_numeric_type_screenshot.png diff --git a/docs/html/resources/articles/images/inputmethod_subtype_notification.png b/docs/html/resources/articles/images/inputmethod_subtype_notification.png Binary files differnew file mode 100644 index 0000000..3f13927 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_subtype_notification.png diff --git a/docs/html/resources/articles/images/inputmethod_subtype_preferences.png b/docs/html/resources/articles/images/inputmethod_subtype_preferences.png Binary files differnew file mode 100644 index 0000000..d8aa0cf --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_subtype_preferences.png diff --git a/docs/html/resources/articles/images/inputmethod_subtype_settings.png b/docs/html/resources/articles/images/inputmethod_subtype_settings.png Binary files differnew file mode 100644 index 0000000..b8942c6 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_subtype_settings.png diff --git a/docs/html/resources/articles/images/inputmethod_text_type_screenshot.png b/docs/html/resources/articles/images/inputmethod_text_type_screenshot.png Binary files differnew file mode 100644 index 0000000..8008b27 --- /dev/null +++ b/docs/html/resources/articles/images/inputmethod_text_type_screenshot.png 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 0000000..4e097aa --- /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 0000000..0b10824 --- /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 0000000..deb47c4 --- /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 0000000..e3af4c5 --- /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 220a4ed..2947e4a 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 0000000..8d57b4e --- /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 b1c3234..4c55522 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 65a5575..2cbbe99 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 e9c738e..e5c79a1 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 8ad970b..fb4225d 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 e1a5e0f..f003e75 100644 --- a/docs/html/resources/resources_toc.cs +++ b/docs/html/resources/resources_toc.cs @@ -97,6 +97,30 @@ </li> </ul> </li> + + <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> + <ul> + <li><a href="<?cs var:toroot ?>training/efficient-downloads/efficient-network-access.html"> + <span class="en">Optimizing Downloads for Efficient Network Access</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/efficient-downloads/regular_updates.html"> + <span class="en">Minimizing the Effect of Regular Updates</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/efficient-downloads/redundant_redundant.html"> + <span class="en">Redundant Downloads are Redundant</span> + </a> + </li> + <li><a href="<?cs var:toroot ?>training/efficient-downloads/connectivity_patterns.html"> + <span class="en">Modifying Patterns Based on the Connectivity Type</span> + </a> + </li> + </ul> + </li> <li class="toggle-list"> <div><a href="<?cs var:toroot ?>training/search/index.html"> @@ -254,6 +278,23 @@ </li> </ul> </li> + + <li class="toggle-list"> + <div><a href="<?cs var:toroot ?>training/accessibility/index.html"> + <span class="en">Implementing Accessibility</span> + </a> <span class="new">new!</span></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 86ec836..751965f 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 0000000..d426c22 --- /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 0000000..e181e58 --- /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 0000000..acfdd89 --- /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 0000000..a9101ab --- /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 cc8cb3e..70ba06c 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 4b861e2..f88b768 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 ca27bba..599b2a8 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 39a234f..3acb358 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 c8563ac..f6dbee0 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 30d807f..f81e8ae 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 c8bf12d..e117118 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> @@ -135,7 +170,9 @@ ADT 17.0.0</a> <em>(March 2012)</em> <li>Added feature to automatically setup JAR dependencies. Any {@code .jar} files in the {@code /libs} folder are added to the build configuration (similar to how the Ant build system works). Also, {@code .jar} files needed by library projects are also automatically - added to projects that depend on those library projects.</li> + added to projects that depend on those library projects. + (<a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects">more + info</a>)</li> <li>Added a feature that allows you to run some code only in debug mode. Builds now generate a class called {@code BuildConfig} containing a {@code DEBUG} constant that is automatically set according to your build type. You can check the ({@code BuildConfig.DEBUG}) @@ -466,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> @@ -518,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> @@ -654,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> @@ -684,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> @@ -734,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> @@ -843,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> @@ -872,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> @@ -1018,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> @@ -1036,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> @@ -1085,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> @@ -1112,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> @@ -1316,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> @@ -1343,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 c09b3c2..b56ccdb 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 1dce483..7461eb0 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 a1c59e3..6f06de3 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 818a0af..88d66dd 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 5a5517c..3aafea9 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 bbbca81..f4e9d4d 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> @@ -128,7 +171,8 @@ generate a class called {@code BuildConfig} containing a {@code DEBUG} constant automatically set according to your build type. You can check the ({@code BuildConfig.DEBUG}) constant in your code to run debug-only functions.</li> <li>Fixed issue when a project and its libraries include the same jar file in their libs - folder.</li> + folder. (<a href="http://tools.android.com/recent/dealingwithdependenciesinandroidprojects">more + info</a>)</li> <li>Added support for custom views with custom attributes in libraries. Layouts using custom attributes must use the namespace URI {@code http://schemas.android.com/apk/res-auto} instead of the URI that includes the app package name. This URI is replaced with the app specific one at diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd index 6869d74..3be0faf 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/training/accessibility/accessible-app.jd b/docs/html/training/accessibility/accessible-app.jd new file mode 100644 index 0000000..f4087b8 --- /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 0000000..d5178a9 --- /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 0000000..f62506b --- /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/efficient-downloads/connectivity_patterns.jd b/docs/html/training/efficient-downloads/connectivity_patterns.jd new file mode 100644 index 0000000..81f1540 --- /dev/null +++ b/docs/html/training/efficient-downloads/connectivity_patterns.jd @@ -0,0 +1,76 @@ +page.title=Modifying your Download Patterns Based on the Connectivity Type +parent.title=Transferring Data Without Draining the Battery +parent.link=index.html + +trainingnavtop=true +previous.title=Redundant Downloads are Redundant +previous.link=redundant_redundant.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#WiFi">Use Wi-Fi</a></li> + <li><a href="#Bandwidth">Use greater bandwidth to download more data less often</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> +</ul> + +</div> +</div> + +<p>When it comes to impact on battery life, not all connection types are created equal. Not only does the Wi-Fi radio use significantly less battery than its wireless radio counterparts, but the radios used in different wireless radio technologies have different battery implications.</p> + +<h2 id="WiFi">Use Wi-Fi</h2> + +<p>In most cases a Wi-Fi radio will offer greater bandwidth at a significantly lower battery cost. As a result, you should endeavor to perform data transfers when connected over Wi-Fi whenever possible.</p> + +<p>You can use a broadcast receiver to listen for connectivity changes that indicate when a Wi-Fi connection has been established to execute significant downloads, preempt scheduled updates, and potentially even temporarily increase the frequency of regular updates as described in <a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a> lesson <a href="{@docRoot}training/monitoring-device-state/connectivity-monitoring.html">Determining and Monitoring the Connectivity Status</a>.</p> + +<h2 id="Bandwidth">Use Greater Bandwidth to Download More Data Less Often</h2> + +<p>When connected over a wireless radio, higher bandwidth generally comes at the price of higher battery cost. Meaning that LTE typically consumes more energy than 3G, which is in turn more expensive than 2G.</p> + +<p>This means that while the underlying radio state machine varies based on the radio technology, generally speaking the relative battery impact of the state change tail-time is greater for higher bandwidth radios.</p> + +<p>At the same time, the higher bandwidth means you can prefetch more aggressively, downloading more data over the same time. Perhaps less intuitively, because the tail-time battery cost is relatively higher, it's also more efficient to keep the radio active for longer periods during each transfer session to reduce the frequency of updates.</p> + +<p>For example, if an LTE radio is has double the bandwidth and double the energy cost of 3G, you should download 4 times as much data during each session—or potentially as much as 10mb. When downloading this much data, it's important to consider the effect of your prefetching on the available local storage and flush your prefetch cache regularly.</p> + +<p>You can use the connectivity manager to determine the active wireless radio, and modify your prefetching routines accordingly:</p> + +<pre>ConnectivityManager cm = + (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); + +TelephonyManager tm = + (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); + +NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + +int PrefetchCacheSize = DEFAULT_PREFETCH_CACHE; + +switch (activeNetwork.getType()) { + case (ConnectivityManager.TYPE_WIFI): + PrefetchCacheSize = MAX_PREFETCH_CACHE; break; + case (ConnectivityManager.TYPE_MOBILE): { + switch (tm.getNetworkType()) { + case (TelephonyManager.NETWORK_TYPE_LTE | + TelephonyManager.NETWORK_TYPE_HSPAP): + PrefetchCacheSize *= 4; + break; + case (TelephonyManager.NETWORK_TYPE_EDGE | + TelephonyManager.NETWORK_TYPE_GPRS): + PrefetchCacheSize /= 2; + break; + default: break; + } + break; + } + default: break; +}</pre>
\ No newline at end of file diff --git a/docs/html/training/efficient-downloads/efficient-network-access.jd b/docs/html/training/efficient-downloads/efficient-network-access.jd new file mode 100644 index 0000000..0efad7d --- /dev/null +++ b/docs/html/training/efficient-downloads/efficient-network-access.jd @@ -0,0 +1,170 @@ +page.title=Optimizing Downloads for Efficient Network Access +parent.title=Transferring Data Without Draining the Battery +parent.link=index.html + +trainingnavtop=true +next.title=Minimizing the Effect of Regular Updates +next.link=regular_updates.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#RadioStateMachine">Understand the radio state machine</a></li> + <li><a href="#AppsStateMachine">Understand how apps can impact the radio state machine</a></li> + <li><a href="#PrefetchData">Efficiently prefetch data</a></li> + <li><a href="#BatchTransfers">Batch transfers and connections</a></li> + <li><a href="#ReduceConnections">Reduce the number of connections you use</a></li> + <li><a href="#DDMSNetworkTraffic">Use the DDMS Network Traffic Tool to identify areas of concern</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> +</ul> + +</div> +</div> + +<p>Using the wireless radio to transfer data is potentially one of your app's most significant sources of battery drain. To minimize the battery drain associated with network activity, it's critical that you understand how your connectivity model will affect the underlying radio hardware.</p> + +<p>This lesson introduces the wireless radio state machine and explains how your app's connectivity model interacts with it. It goes on to propose ways to minimize your data connections, use prefetching, and bundle your transfers in order to minimize the battery drain associated with your data transfers.</p> + +<h2 id="RadioStateMachine">The Radio State Machine</h2> + +<p>A fully active wireless radio consumes significant power, so it transitions between different energy states in order to conserve power when not in use, while attempting to minimize latency associated with "powering up" the radio when it's required.</p> + +<p>The state machine for a typical 3G network radio consists of three energy states: +<ol><li><b>Full power</b>: Used when a connection is active, allowing the device to transfer data at its highest possible rate.</li> +<li><b>Low power</b>: An intermediate state that uses around 50% of the battery power at the full state.</li> +<li><b>Standby</b>: The minimal energy state during which no network connection is active or required.</li> +</ol></p> + +<p>While the low and idle states drain significantly less battery, they also introduce significant latency to network requests. Returning to full power from the low state takes around 1.5 seconds, while moving from idle to full can take over 2 seconds.</p> + +<p>To minimize latency, the state machine uses a delay to postpone the transition to lower energy states. Figure 1 uses AT&T's timings for a typical 3G radio.</p> + +<img src="{@docRoot}images/efficient-downloads/mobile_radio_state_machine.png" /> +<p class="img-caption"><strong>Figure 1.</strong> Typical 3G wireless radio state machine.</p> + +<p>The radio state machine on each device, particularly the associated transition delay ("tail time") and startup latency, will vary based on the wireless radio technology employed (2G, 3G, LTE, etc.) and is defined and configured by the carrier network over which the device is operating.</p> + +<p>This lesson describes a representative state machine for a typical 3G wireless radio, based on <a href="http://www.research.att.com/articles/featured_stories/2011_03/201102_Energy_efficient?fbid=1zObBOMOZSB">data provided by AT&T</a>. However, the general principles and resulting best practices are applicable for all wireless radio implementations.</p> + +<p>This approach is particularly effective for typical web browsing as it prevents unwelcome latency while users browse the web. The relatively low tail-time also ensures that once a browsing session has finished, the radio can move to a lower energy state.</p> + +<p>Unfortunately, this approach can lead to inefficient apps on modern smartphone OSs like Android, where apps run both in the foreground (where latency is important) and in the background (where battery life should be prioritized).</p> + +<h2 id="AppsStateMachine">How Apps Impact the Radio State Machine</h2> + +<p>Every time you create a new network connection, the radio transitions to the full power state. In the case of the typical 3G radio state machine described above, it will remain at full power for the duration of your transfer—plus an additional 5 seconds of tail time—followed by 12 seconds at the low energy state. So for a typical 3G device, every data transfer session will cause the radio to draw energy for almost 20 seconds.</p> + +<p>In practice, this means an app that transfers unbundled data for 1 second every 18 seconds will keep the wireless radio perpetually active, moving it back to high power just as it was about to become idle. As a result, every minute it will consume battery at the high power state for 18 seconds, and at the low power state for the remaining 42 seconds.</p> + +<p>By comparison, the same app that bundles transfers of 3 seconds of every minute will keep the radio in the high power state for only 8 seconds, and will keep it in the low power state for only an additional 12 seconds.</p> + +<p>The second example allows the radio to be idle for an additional 40 second every minute, resulting in a massive reduction in battery consumption.</p> + +<img src="{@docRoot}images/efficient-downloads/graphs.png" /> +<p class="img-caption"><strong>Figure 2.</strong> Relative wireless radio power use for bundled versus unbundled transfers.</p> + +<h2 id="PrefetchData">Prefetch Data</h2> + +<p>Prefetching data is an effective way to reduce the number of independent data transfer sessions. Prefetching allows you to download all the data you are likely to need for a given time period in a single burst, over a single connection, at full capacity.</p> + +<p>By front loading your transfers, you reduce the number of radio activations required to download the data. As a result you not only conserve battery life, but also improve the latency, lower the required bandwidth, and reduce download times.</p> + +<p>Prefetching also provides an improved user experience by minimizing in-app latency caused by waiting for downloads to complete before performing an action or viewing data.</p> + +<p>However, used too aggressively, prefetching introduces the risk of increasing battery drain and bandwidth use—as well as download quota—by downloading data that isn't used. It's also important to ensure that prefetching doesn't delay application startup while the app waits for the prefetch to complete. In practical terms that might mean processing data progressively, or initiating consecutive transfers prioritized such that the data required for application startup is downloaded and processed first.</p> + +<p>How aggressively you prefetch depends on the size of the data being downloaded and the likelihood of it being used. As a rough guide, based on the state machine described above, for data that has a 50% chance of being used within the current user session, you can typically prefetch for around 6 seconds (approximately 1-2 Mb) before the potential cost of downloading unused data matches the potential savings of not downloading that data to begin with.</p> + +<p>Generally speaking, it's good practice to prefetch data such that you will only need to initiate another download every 2 to 5 minutes, and in the order of 1 to 5 megabytes.</p> + +<p>Following this principle, large downloads—such as video files—should be downloaded in chunks at regular intervals (every 2 to 5 minutes), effectively prefetching only the video data likely to be viewed in the next few minutes.</p> + +<p>Note that further downloads should be bundled, as described in the next section, <a href="#BatchTransfers">Batch Transfers and Connections</a>, and that these approximations will vary based on the connection type and speed, as discussed in <a href="connectivity_patterns.html">Modify your Download Patterns Based on the Connectivity Type</a>.</p> + +<p>Let's look at some practical examples:</p> + +<p><b>A music player</b></p> + +<p>You could choose to prefetch an entire album, however should the user stop listening after the first song, you've wasted a significant amount of bandwidth and battery life.</p> + +<p>A better approach would be to maintain a buffer of one song in addition to the one being played. For streaming music, rather than maintaining a continuous stream that keeps the radio active at all times, consider using HTTP live streaming to transmit the audio stream in bursts, simulating the prefetching approach described above.</p> + +<p><b>A news reader</b></p> + +<p>Many news apps attempt to reduce bandwidth by downloading headlines only after a category has been selected, full articles only when the user wants to read them, and thumbnails just as they scroll into view.</p> + +<p>Using this approach, the radio will be forced to remain active for the majority of users' news-reading session as they scroll headlines, change categories, and read articles. Not only that, but the constant switching between energy states will result in significant latency when switching categories or reading articles.</p> + +<p>A better approach would be to prefetch a reasonable amount of data at startup, beginning with the first set of news headlines and thumbnails—ensuring a low latency startup time—and continuing with the remaining headlines and thumbnails, as well as the article text for each article available from at least the primary headline list.</p> + +<p>Another alternative is to prefetch every headline, thumbnail, article text, and possibly even full article pictures—typically in the background on a predetermined schedule. This approach risks spending significant bandwidth and battery life downloading content that's never used, so it should be implemented with caution.</p> + +<p>One solution is to schedule the full download to occur only when connected to Wi-Fi, and possibly only when the device is charging. This is investigated in more detail in <a href="connectivity_patterns.html">Modify your Download Patterns Based on the Connectivity Type</a>.</p> + +<h2 id="BatchTransfers">Batch Transfers and Connections</h2> + +Every time you initiate a connection—irrespective of the size of the associated data transfer—you potentially cause the radio to draw power for nearly 20 seconds when using a typical 3G wireless radio.</p> + +<p>An app that pings the server every 20 seconds, just to acknowledge that the app is running and visible to the user, will keep the radio powered on indefinitely, resulting in a significant battery cost for almost no actual data transfer.</p> + +<p>With that in mind it's important to bundle your data transfers and create a pending transfer queue. Done correctly, you can effectively phase-shift transfers that are due to occur within a similar time window, to make them all happen simultaneously—ensuring that the radio draws power for as short a duration as possible.</p> + +<p>The underlying philosophy of this approach is to transfer as much data as possible during each transfer session in an effort to limit the number of sessions you require.</p> + +<p>That means you should batch your transfers by queuing delay tolerant transfers, and preempting scheduled updates and prefetches, so that they are all executed when time-sensitive transfers are required. Similarly, your scheduled updates and regular prefetching should initiate the execution of your pending transfer queue.</p> + +<p>For a practical example, let's return to the earlier examples from <a href="#PrefetchData">Prefetch Data</a>.</p> + +<p>Take a news application that uses the prefetching routine described above. The news reader collects analytics information to understand the reading patterns of its users and to rank the most popular stories. To keep the news fresh, it checks for updates every hour. To conserve bandwidth, rather than download full photos for each article, it prefetches only thumbnails and downloads the full photos when they are selected.</p> + +<p>In this example, all the analytics information collected within the app should be bundled together and queued for download, rather than being transmitted as it's collected. The resulting bundle should be transferred when either a full-sized photo is being downloaded, or when an hourly update is being performed.</p> + +<p>Any time-sensitive or on-demand transfer—such as downloading a full-sized image—should preempt regularly scheduled updates. The planned update should be executed at the same time as the on-demand transfer, with the next update scheduled to occur after the set interval. This approach mitigates the cost of performing a regular update by piggy-backing on the necessary time-sensitive photo download.</p> + +<h2 id="ReduceConnections">Reduce Connections</h2> + +<p>It's generally more efficient to reuse existing network connections than to initiate new ones. Reusing connections also allows the network to more intelligently react to congestion and related network data issues.</p> + +<p>Rather than creating multiple simultaneous connections to download data, or chaining multiple consecutive GET requests, where possible you should bundle those requests into a single GET.</p> + +<p>For example, it would be more efficient to make a single request for every news article to be returned in a single request / response than to make multiple queries for several news categories. +The wireless radio needs to become active in order to transmit the termination / termination acknowledgement packets associated with server and client timeout, so it's also good practice to close your connections when they aren't in use, rather than waiting for these timeouts.</p> + +<p>That said, closing a connection too early can prevent it from being reused, which then requires additional overhead for establishing a new connection. A useful compromise is not to close the connection immediately, but to still close it before the inherent timeout expires.</p> + +<h2 id="DDMSNetworkTraffic">Use the DDMS Network Traffic Tool to Identify Areas of Concern</h2> + +<p>The Android <a href="{@docRoot}guide/developing/debugging/ddms.html">DDMS (Dalvik Debug Monitor Server)</a> includes a Detailed Network Usage tab that makes it possible to track when your application is making network requests. Using this tool, you can monitor how and when your app transfers data and optimize the underlying code appropriately.</p> + +<p>Figure 3 shows a pattern of transferring small amounts of data roughly 15 seconds apart, suggesting that efficiency could be dramatically improved by prefetching each request or bundling the uploads.</p> + +<img src="{@docRoot}images/efficient-downloads/DDMS.png" /> +<p class="img-caption"><strong>Figure 3.</strong> Tracking network usage with DDMS.</p> + +<p>By monitoring the frequency of your data transfers, and the amount of data transferred during each connection, you can identify areas of your application that can be made more battery-efficient. Generally, you will be looking for short spikes that can be delayed, or that should cause a later transfer to be preempted.</p> + +<p>To better identify the cause of transfer spikes, the Traffic Stats API allows you to tag the data transfers occurring within a thread using the {@code TrafficStats.setThreadStatsTag()} method, followed by manually tagging (and untagging) individual sockets using {@code tagSocket()} and {@code untagSocket()}. For example:</p> + +<pre>TrafficStats.setThreadStatsTag(0xF00D); +TrafficStats.tagSocket(outputSocket); +// Transfer data using socket +TrafficStats.untagSocket(outputSocket);</pre> + +<p>The Apache {@code HttpClient} and {@code URLConnection} libraries automatically tag sockets based on the current {@code getThreadStatsTag()} value. These libraries also tag and untag sockets when recycled through keep-alive pools.</p> + +<pre>TrafficStats.setThreadStatsTag(0xF00D); +try { + // Make network request using HttpClient.execute() +} finally { + TrafficStats.clearThreadStatsTag(); +}</pre> + +<p>Socket tagging is supported in Android 4.0, but real-time stats will only be displayed on devices running Android 4.0.3 or higher.</p>
\ No newline at end of file diff --git a/docs/html/training/efficient-downloads/index.jd b/docs/html/training/efficient-downloads/index.jd new file mode 100644 index 0000000..a29be91 --- /dev/null +++ b/docs/html/training/efficient-downloads/index.jd @@ -0,0 +1,51 @@ +page.title=Transferring Data Without Draining the Battery + +trainingnavtop=true +startpage=true +next.title=Optimizing Downloads for Efficient Network Access +next.link=efficient-network-access.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<!-- Required platform, tools, add-ons, devices, knowledge, etc. --> +<h2>Dependencies and prerequisites</h2> +<ul> + <li>Android 2.0 (API Level 5) or higher</li> +</ul> + +<!-- related docs (NOT javadocs) --> +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> +</ul> + +</div> +</div> + +<p>In this class you will learn to minimize the battery life impact of downloads and network connections, particularly in relation to the wireless radio.</P + +<p>This class demonstrates the best practices for scheduling and executing downloads using techniques such as caching, polling, and prefetching. You will learn how the power-use profile of the wireless radio can affect your choices on when, what, and how to transfer data in order to minimize impact on battery life.</p> + +<h2>Lessons</h2> + +<!-- Create a list of the lessons in this class along with a short description of each lesson. +These should be short and to the point. It should be clear from reading the summary whether someone +will want to jump to a lesson or not.--> + +<dl> + <dt><b><a href="efficient-network-access.html">Optimizing Downloads for Efficient Network Access</a></b></dt> + <dd>This lesson introduces the wireless radio state machine, explains how your app’s connectivity model interacts with it, and how you can minimize your data connection and use prefetching and bundling to minimize the battery drain associated with your data transfers.</dd> + + <dt><b><a href="regular_updates.html">Minimizing the Effect of Regular Updates</a></b></dt> + <dd>This lesson will examine how your refresh frequency can be varied to best mitigate the effect of background updates on the underlying wireless radio state machine.</dd> + + <dt><b><a href="redundant_redundant.html">Redundant Downloads are Redundant</a></b></dt> + <dd>The most fundamental way to reduce your downloads is to download only what you need. This lesson introduces some best practices to eliminate redundant downloads.</dd> + + <dt><b><a href="connectivity_patterns.html">Modifying your Download Patterns Based on the Connectivity Type</a></b></dt> + <dd>When it comes to impact on battery life, not all connection types are created equal. Not only does the Wi-Fi radio use significantly less battery than its wireless radio counterparts, but the radios used in different wireless radio technologies have different battery implications.</dd> + +</dl> diff --git a/docs/html/training/efficient-downloads/redundant_redundant.jd b/docs/html/training/efficient-downloads/redundant_redundant.jd new file mode 100644 index 0000000..4bf9af9 --- /dev/null +++ b/docs/html/training/efficient-downloads/redundant_redundant.jd @@ -0,0 +1,87 @@ +page.title=Redundant Downloads are Redundant +parent.title=Transferring Data Without Draining the Battery +parent.link=index.html + +trainingnavtop=true +previous.title=Minimizing the Effect of Regular Updates +previous.link=regular_updates.html +next.title=Connectivity Based Download Patterns +next.link=connectivity_patterns.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#LocalCache">Cache files locally</a></li> + <li><a href="#ResponseCache">Use the HttpURLConnection response cache</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> +</ul> + +</div> +</div> + +<p>The most fundamental way to reduce your downloads is to download only what you need. In terms of data, that means implementing REST APIs that allow you to specify query criteria that limit the returned data by using parameters such as the time of your last update.</p> + +<p>Similarly, when downloading images, it's good practice to reduce the size of the images server-side, rather than downloading full-sized images that are reduced on the client.</p> + +<h2 id="LocalCache">Cache Files Locally</h2> + +<p>Another important technique is to avoid downloading duplicate data. You can do this by aggressive caching. Always cache static resources, including on-demand downloads such as full size images, for as long as reasonably possible. On-demand resources should be stored separately to enable you to regularly flush your on-demand cache to manage its size.</p> + +<p>To ensure that your caching doesn't result in your app displaying stale data, be sure to extract the time at which the requested content was last updated, and when it expires, from within the HTTP response headers. This will allow you to determine when the associated content should be refreshed.</p> + +<pre>long currentTime = System.currentTimeMillis()); + +HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + +long expires = conn.getHeaderFieldDate("Expires", currentTime); +long lastModified = conn.getHeaderFieldDate("Last-Modified", currentTime); + +setDataExpirationDate(expires); + +if (lastModified < lastUpdateTime) { + // Skip update +} else { + // Parse update +}</pre> + +<p>Using this approach, you can also effectively cache dynamic content while ensuring it doesn't result in your application displaying stale information.</p> + +<p>You can cache non-sensitive data can in the unmanaged external cache directory:</p> + +<pre>Context.getExternalCacheDir();</pre> + +<p>Alternatively, you can use the managed / secure application cache. Note that this internal cache may be flushed when the system is running low on available storage.</p> + +<pre>Context.getCache();</pre> + +<p>Files stored in either cache location will be erased when the application is uninstalled.</p> + +<h2 id="ResponseCache">Use the HttpURLConnection Response Cache</h2> + +<p>Android 4.0 added a response cache to {@code HttpURLConnection}. You can enable HTTP response caching on supported devices using reflection as follows:</p> + +<pre>private void enableHttpResponseCache() { + try { + long httpCacheSize = 10 * 1024 * 1024; // 10 MiB + File httpCacheDir = new File(getCacheDir(), "http"); + Class.forName("android.net.http.HttpResponseCache") + .getMethod("install", File.class, long.class) + .invoke(null, httpCacheDir, httpCacheSize); + } catch (Exception httpResponseCacheNotAvailable) { + Log.d(TAG, "HTTP response cache is unavailable."); + } +}</pre> + +<p>This sample code will turn on the response cache on Android 4.0+ devices without affecting earlier releases.</p> + +<p>With the cache installed, fully cached HTTP requests can be served directly from local storage, eliminating the need to open a network connection. Conditionally cached responses can validate their freshness from the server, eliminating the bandwidth cost associated with the download.</p> + +<p>Uncached responses get stored in the response cache for for future requests.</p>
\ No newline at end of file diff --git a/docs/html/training/efficient-downloads/regular_updates.jd b/docs/html/training/efficient-downloads/regular_updates.jd new file mode 100644 index 0000000..feb7a8e --- /dev/null +++ b/docs/html/training/efficient-downloads/regular_updates.jd @@ -0,0 +1,102 @@ +page.title=Minimizing the Effect of Regular Updates +parent.title=Transferring Data Without Draining the Battery +parent.link=index.html + +trainingnavtop=true +previous.title=Optimizing Downloads for Efficient Network Access +previous.link=efficient-network-access.html +next.title=Redundant Downloads are Redundant +next.link=redundant_redundant.html + +@jd:body + +<div id="tb-wrapper"> +<div id="tb"> + +<h2>This lesson teaches you to</h2> +<ol> + <li><a href="#C2DM">Use Cloud to Device Messaging as an alternative to polling</a></li> + <li><a href="#OptimizedPolling">Optimize polling with inexact repeating alarms and exponential back-offs</a></li> +</ol> + +<h2>You should also read</h2> +<ul> + <li><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a></li> + <li><a href="http://code.google.com/android/c2dm/">Android Cloud to Device Messaging</a></li> +</ul> + +</div> +</div> + +<p>The optimal frequency of regular updates will vary based on device state, network connectivity, user behavior, and explicit user preferences.</p> + +<p><a href="{@docRoot}training/monitoring-device-state/index.html">Optimizing Battery Life</a> discusses how to build battery-efficient apps that modify their refresh frequency based on the state of the host device. That includes disabling background service updates when you lose connectivity and reducing the rate of updates when the battery level is low.</p> + +<p>This lesson will examine how your refresh frequency can be varied to best mitigate the effect of background updates on the underlying wireless radio state machine.</p> + +<h2 id="C2DM">Use Cloud to Device Messaging as an Alternative to Polling</h2> + +<p>Every time your app polls your server to check if an update is required, you activate the wireless radio, drawing power unnecessarily, for up to 20 seconds on a typical 3G connection.</p> + +<p><a href="http://code.google.com/android/c2dm/">Android Cloud to Device Messaging (C2DM)</a> is a lightweight mechanism used to transmit data from a server to a particular app instance. Using C2DM, your server can notify your app running on a particular device that there is new data available for it.</p> + +<p>Compared to polling, where your app must regularly ping the server to query for new data, this event-driven model allows your app to create a new connection only when it knows there is data to download.</p> + +<p>The result is a reduction in unnecessary connections, and a reduced latency for updated data within your application.</p> + +<p>C2DM is implemented using a persistent TCP/IP connection. While it's possible to implement your own push service, it's best practice to use C2DM. This minimizes the number of persistent connections and allows the platform to optimize bandwidth and minimize the associated impact on battery life.</p> + +<h2 id="OptimizedPolling">Optimize Polling with Inexact Repeating Alarms and Exponential Backoffs</h2> + +<p>Where polling is required, it's good practice to set the default data refresh frequency of your app as low as possible without detracting from the user experience.</p> + +<p>A simple approach is to offer preferences to allow users to explicitly set their required update rate, allowing them to define their own balance between data freshness and battery life.</p> + +<p>When scheduling updates, use inexact repeating alarms that allow the system to "phase shift" the exact moment each alarm triggers.</p> + +<pre>int alarmType = AlarmManager.ELAPSED_REALTIME; +long interval = AlarmManager.INTERVAL_HOUR; +long start = System.currentTimeMillis() + interval; + +alarmManager.setInexactRepeating(alarmType, start, interval, pi);</pre> + +<p>If several alarms are scheduled to trigger at similar times, this phase-shifting will cause them to be triggered simultaneously, allowing each update to piggyback on top of a single active radio state change.</p> + +<p>Wherever possible, set your alarm type to {@code ELAPSED_REALTIME} or {@code RTC} rather than to their {@code _WAKEUP} equivalents. This further reduces battery impact by waiting until the phone is no longer in standby mode before the alarm triggers.</p> + +<p>You can further reduce the impact of these scheduled alarms by opportunistically reducing their frequency based on how recently your app was used.</p> + +<p>One approach is to implement an exponential back-off pattern to reduce the frequency of your updates (and / or the degree of prefetching you perform) if the app hasn't been used since the previous update. It's often useful to assert a minimum update frequency and to reset the frequency whenever the app is used, for example:</p> + +<pre>SharedPreferences sp = + context.getSharedPreferences(PREFS, Context.MODE_WORLD_READABLE); + +boolean appUsed = sp.getBoolean(PREFS_APPUSED, false); +long updateInterval = sp.getLong(PREFS_INTERVAL, DEFAULT_REFRESH_INTERVAL); + +if (!appUsed) + if ((updateInterval *= 2) > MAX_REFRESH_INTERVAL) + updateInterval = MAX_REFRESH_INTERVAL; + +Editor spEdit = sp.edit(); +spEdit.putBoolean(PREFS_APPUSED, false); +spEdit.putLong(PREFS_INTERVAL, updateInterval); +spEdit.apply(); + +rescheduleUpdates(updateInterval); +executeUpdateOrPrefetch();</pre> + +<p>You can use a similar exponential back-off pattern to reduce the effect of failed connections and download errors.</p> + +<p>The cost of initiating a network connection is the same whether you are able to contact your server and download data or not. For time-sensitive transfers where successful completion is important, an exponential back-off algorithm can be used to reduce the frequency of retries in order to minimize the associated battery impact, for example:</p> + +<pre>private void retryIn(long interval) { + boolean success = attemptTransfer(); + + if (!success) { + retryIn(interval*2 < MAX_RETRY_INTERVAL ? + interval*2 : MAX_RETRY_INTERVAL); + } +}</pre> + +<p>Alternatively, for transfers that are failure tolerant (such as regular updates), you can simply ignore failed connection and transfer attempts.</p>
\ No newline at end of file diff --git a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java index ba06996..f3e7d4a 100644 --- a/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimPukUnlockScreen.java @@ -106,7 +106,7 @@ public class SimPukUnlockScreen extends LinearLayout implements KeyguardScreen, mHeaderText.setSelected(true); mKeyguardStatusViewManager = new KeyguardStatusViewManager(this, updateMonitor, - lockpatternutils, callback, false); + lockpatternutils, callback, true); mPinText.setFocusableInTouchMode(true); mPinText.setOnFocusChangeListener(this); |
