diff options
Diffstat (limited to 'docs/html/guide')
25 files changed, 324 insertions, 414 deletions
diff --git a/docs/html/guide/appendix/media-formats.jd b/docs/html/guide/appendix/media-formats.jd index 9070968..7c6c145 100644 --- a/docs/html/guide/appendix/media-formats.jd +++ b/docs/html/guide/appendix/media-formats.jd @@ -217,9 +217,17 @@ rates for raw PCM recordings at 8000, 16000 and 44100 Hz.</td> </tr> <tr> -<td>WEBP</td> -<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 4.0+)</small></td> -<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 4.0+)</small></td> +<td>WebP</td> +<td style="text-align: center;" nowrap> + <big>•</big><br> + <small>(Android 4.0+)</small><br> + <small>(Lossless, Transparency, Android 4.2.1+)</small> +</td> +<td style="text-align: center;" nowrap> + <big>•</big><br> + <small>(Android 4.0+)</small><br> + <small>(Lossless, Transparency, Android 4.2.1+)</small> +</td> <td> </td> <td> WebP (.webp)</td> diff --git a/docs/html/guide/components/index.jd b/docs/html/guide/components/index.jd index 6ede873..87bae53 100644 --- a/docs/html/guide/components/index.jd +++ b/docs/html/guide/components/index.jd @@ -4,14 +4,6 @@ page.landing.intro=Android's application framework lets you create extremely ric page.landing.image=images/develop/app_components.png @jd:body -<div id="butterbar-wrapper" > - <div id="butterbar" > - <div id="butterbar-message"> -<a target="_blank" href="https://docs.google.com/a/google.com/forms/d/1EHLPGqhbxj2HungHRRN4_0K9TGpc-Izy-u46vBDgS8Q/viewform"> - Take the Android Developer Survey</a> - </div> - </div> -</div> <div class="landing-docs"> diff --git a/docs/html/guide/components/tasks-and-back-stack.jd b/docs/html/guide/components/tasks-and-back-stack.jd index a21bf34..f818873 100644 --- a/docs/html/guide/components/tasks-and-back-stack.jd +++ b/docs/html/guide/components/tasks-and-back-stack.jd @@ -142,9 +142,8 @@ started Task A. Now, Task A comes to the foreground—all three activities in its stack are intact and the activity at the top of the stack resumes. At this point, the user can also switch back to Task B by going Home and selecting the application icon -that started that task (or by touching and holding the <em>Home</em> button to reveal recent tasks -and selecting -one). This is an example of multitasking on Android.</p> +that started that task (or by selecting the app's task from the <em>recent apps</em> screen). +This is an example of multitasking on Android.</p> <p class="note"><strong>Note:</strong> Multiple tasks can be held in the background at once. However, if the user is running many background tasks at the same time, the system might begin diff --git a/docs/html/guide/guide_toc.cs b/docs/html/guide/guide_toc.cs index db08c3e..21d295a 100644 --- a/docs/html/guide/guide_toc.cs +++ b/docs/html/guide/guide_toc.cs @@ -146,9 +146,6 @@ <li><a href="<?cs var:toroot ?>guide/topics/ui/layout/grid.html"> <span class="en">Grid Layout</span> </a></li> - <li><a href="<?cs var:toroot ?>guide/topics/ui/layout/tabs.html"> - <span class="en">Tab Layout</span> - </a></li> --> <li><a href="<?cs var:toroot ?>guide/topics/ui/layout/listview.html"> <span class="en">List View</span> @@ -411,7 +408,7 @@ </ul> </li> <li><a href="<?cs var:toroot?>guide/topics/connectivity/wifip2p.html"> - <span class="en">Wi-Fi Direct</span></a> + <span class="en">Wi-Fi P2P</span></a> </li> <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot?>guide/topics/connectivity/usb/index.html"> diff --git a/docs/html/guide/practices/optimizing-for-3.0.jd b/docs/html/guide/practices/optimizing-for-3.0.jd index 465a847..fea54af 100644 --- a/docs/html/guide/practices/optimizing-for-3.0.jd +++ b/docs/html/guide/practices/optimizing-for-3.0.jd @@ -54,7 +54,7 @@ onclick="$('#naMessage').hide();$('#deprecatedSticker').show()" /> <li><a href="tablets-and-handsets.html">Supporting Tablets and Handsets</a></li> <li><a -href="{@docRoot}tools/extras/support-library.html">Compatibility Library</a></li> +href="{@docRoot}tools/support-library/index.html">Compatibility Library</a></li> <li><a href="http://code.google.com/p/iosched/">Google I/O App source code</a></li> </ol> @@ -281,7 +281,7 @@ use techniques such as reflection to check for the availability of certain APIs to help you add features from Android 3.0 without requiring you to change your <a 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}tools/extras/support-library.html">Compatibility Library</a> +href="{@docRoot}tools/support-library/index.html">Compatibility Library</a> (downloadable from the Android SDK Manager).</p> <p>This library includes APIs for <a href="{@docRoot}guide/components/fragments.html">fragments</a>, <a @@ -289,7 +289,7 @@ href="{@docRoot}guide/components/loaders.html">loaders</a>, and some updated cla simply adding this library to your Android project, you can use these APIs in your application and remain compatible with Android 1.6. For information about how to get the library and start using it in your application, see the <a -href="{@docRoot}tools/extras/support-library.html">Compatibility Library</a> document.</p> +href="{@docRoot}tools/support-library/index.html">Compatibility Library</a> document.</p> </div> </div> diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd index 8d6d3dd..a63a368 100644 --- a/docs/html/guide/practices/tablets-and-handsets.jd +++ b/docs/html/guide/practices/tablets-and-handsets.jd @@ -141,7 +141,7 @@ bar below.</p> <h3>Remaining backward-compatible</h3> <p>If you want to use fragments in your application <em>and</em> remain compatible with versions of Android older than 3.0, you can do so by using the Android <a -href="{@docRoot}tools/extras/support-library.html">Support Library</a> (downloadable from the +href="{@docRoot}tools/support-library/index.html">Support Library</a> (downloadable from the SDK Manager).</p> <p>The support library includes APIs for <a href="{@docRoot}guide/components/fragments.html">fragments</a>, <a @@ -150,7 +150,7 @@ versions of Android. By simply adding this library to your Android project, you backward-compatible versions of these APIs in your application and remain compatible with Android 1.6 (your <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a> value can be as low as {@code "4"}). For information about how to get the -library and start using it, see the <a href="{@docRoot}tools/extras/support-library.html">Support +library and start using it, see the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> document.</p> <p>The support library <em>does not</em> provide APIs for the action bar, but you can use diff --git a/docs/html/guide/topics/connectivity/index.jd b/docs/html/guide/topics/connectivity/index.jd index 322518e..385cf08 100644 --- a/docs/html/guide/topics/connectivity/index.jd +++ b/docs/html/guide/topics/connectivity/index.jd @@ -1,6 +1,6 @@ page.title=Connectivity page.landing=true -page.landing.intro=Android provides rich APIs to let your app connect and interact with other devices over Bluetooth, NFC, Wi-Fi Direct, USB, and SIP, in addition to standard network connections. +page.landing.intro=Android provides rich APIs to let your app connect and interact with other devices over Bluetooth, NFC, Wi-Fi P2P, USB, and SIP, in addition to standard network connections. page.landing.image=images/develop/connectivity.png @jd:body diff --git a/docs/html/guide/topics/connectivity/wifip2p.jd b/docs/html/guide/topics/connectivity/wifip2p.jd index 2167a0f..7cadde1 100644 --- a/docs/html/guide/topics/connectivity/wifip2p.jd +++ b/docs/html/guide/topics/connectivity/wifip2p.jd @@ -1,5 +1,5 @@ -page.title=Wi-Fi Direct -page.tags="wireless","WifiP2pManager" +page.title=Wi-Fi Peer-to-Peer +page.tags="wireless","WifiP2pManager","Wi-Fi Direct","WiFi Direct","P2P","Wi-Fi P2P","WiFi P2P" @jd:body @@ -9,10 +9,10 @@ page.tags="wireless","WifiP2pManager" <ol> <li><a href="#api">API Overview</a></li> - <li><a href="#creating-br">Creating a Broadcast Receiver for Wi-Fi Direct Intents</a></li> + <li><a href="#creating-br">Creating a Broadcast Receiver for Wi-Fi P2P Intents</a></li> <li> - <a href="#creating-app">Creating a Wi-Fi Direct Application</a> + <a href="#creating-app">Creating a Wi-Fi P2P Application</a> <ol> <li><a href="#setup">Initial setup</a></li> @@ -25,21 +25,24 @@ page.tags="wireless","WifiP2pManager" </ol> </li> </ol> - <h2>Related Samples</h2> - <ol> - <li><a href="{@docRoot}resources/samples/WiFiDirectDemo/index.html">Wi-Fi Direct Demo</a></li> - </ol> + <h2>See also</h2> + <ul> + <li><a href="{@docRoot}training/connect-devices-wirelessly/wifi-direct.html">Creating + P2P Connections with Wi-Fi</a></li> + </ul> </div> </div> - <p>Wi-Fi Direct allows Android 4.0 (API level 14) or later devices with the appropriate hardware - to connect directly to each other via Wi-Fi without an intermediate access point. - Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi Direct, - then communicate over a speedy connection across distances much longer than a Bluetooth connection. - This is useful for applications that share data among users, such as a multiplayer game or - a photo sharing application.</p> - <p>The Wi-Fi Direct APIs consist of the following main parts:</p> +<p>Wi-Fi peer-to-peer (P2P) allows Android 4.0 (API level 14) or later devices with the appropriate +hardware to connect directly to each other via Wi-Fi without an intermediate access point (Android's +Wi-Fi P2P framework complies with the Wi-Fi Alliance's Wi-Fi Direct™ certification program). +Using these APIs, you can discover and connect to other devices when each device supports Wi-Fi P2P, +then communicate over a speedy connection across distances much longer than a Bluetooth connection. +This is useful for applications that share data among users, such as a multiplayer game or +a photo sharing application.</p> + + <p>The Wi-Fi P2P APIs consist of the following main parts:</p> <ul> <li>Methods that allow you to discover, request, and connect to peers are defined @@ -50,7 +53,7 @@ page.tags="wireless","WifiP2pManager" android.net.wifi.p2p.WifiP2pManager} methods, each method can receive a specific listener passed in as a parameter.</li> - <li>Intents that notify you of specific events detected by the Wi-Fi Direct framework, + <li>Intents that notify you of specific events detected by the Wi-Fi P2P framework, such as a dropped connection or a newly discovered peer.</li> </ul> @@ -70,7 +73,7 @@ page.tags="wireless","WifiP2pManager" the Wi-Fi hardware on your device to do things like discover and connect to peers. The following actions are available:</p> -<p class="table-caption"><strong>Table 1.</strong>Wi-Fi Direct Methods</p> +<p class="table-caption"><strong>Table 1.</strong>Wi-Fi P2P Methods</p> <table> <tr> @@ -80,7 +83,7 @@ page.tags="wireless","WifiP2pManager" <tr> <td>{@link android.net.wifi.p2p.WifiP2pManager#initialize initialize()}</td> - <td>Registers the application with the Wi-Fi framework. This must be called before calling any other Wi-Fi Direct method.</td> + <td>Registers the application with the Wi-Fi framework. This must be called before calling any other Wi-Fi P2P method.</td> </tr> <tr> @@ -126,12 +129,12 @@ page.tags="wireless","WifiP2pManager" <p>{@link android.net.wifi.p2p.WifiP2pManager} methods let you pass in a listener, - so that the Wi-Fi Direct framework can notify your + so that the Wi-Fi P2P framework can notify your activity of the status of a call. The available listener interfaces and the corresponding {@link android.net.wifi.p2p.WifiP2pManager} method calls that use the listeners are described in the following table:</p> - <p class="table-caption"><strong>Table 2.</strong> Wi-Fi Direct Listeners</p> + <p class="table-caption"><strong>Table 2.</strong> Wi-Fi P2P Listeners</p> <table> <tr> @@ -168,12 +171,12 @@ page.tags="wireless","WifiP2pManager" </tr> </table> -<p>The Wi-Fi Direct APIs define intents that are broadcast when certain Wi-Fi Direct events happen, +<p>The Wi-Fi P2P APIs define intents that are broadcast when certain Wi-Fi P2P events happen, such as when a new peer is discovered or when a device's Wi-Fi state changes. You can register to receive these intents in your application by <a href="#creating-br">creating a broadcast receiver</a> that handles these intents:</p> -<p class="table-caption"><strong>Table 3.</strong> Wi-Fi Direct Intents</p> +<p class="table-caption"><strong>Table 3.</strong> Wi-Fi P2P Intents</p> <table> <tr> @@ -194,7 +197,7 @@ page.tags="wireless","WifiP2pManager" </tr> <tr> <td>{@link android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION}</td> - <td>Broadcast when Wi-Fi Direct is enabled or disabled on the device.</td> + <td>Broadcast when Wi-Fi P2P is enabled or disabled on the device.</td> </tr> <tr> <td>{@link android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_THIS_DEVICE_CHANGED_ACTION}</td> @@ -204,11 +207,11 @@ page.tags="wireless","WifiP2pManager" - <h2 id="creating-br">Creating a Broadcast Receiver for Wi-Fi Direct Intents</h2> + <h2 id="creating-br">Creating a Broadcast Receiver for Wi-Fi P2P Intents</h2> <p>A broadcast receiver allows you to receive intents broadcast by the Android system, so that your application can respond to events that you are interested in. The basic steps - for creating a broadcast receiver to handle Wi-Fi Direct intents are as follows:</p> + for creating a broadcast receiver to handle Wi-Fi P2P intents are as follows:</p> <ol> <li>Create a class that extends the {@link android.content.BroadcastReceiver} class. For the @@ -267,17 +270,17 @@ public class WiFiDirectBroadcastReceiver extends BroadcastReceiver { } </pre> - <h2 id="creating-app">Creating a Wi-Fi Direct Application</h2> + <h2 id="creating-app">Creating a Wi-Fi P2P Application</h2> - <p>Creating a Wi-Fi Direct application involves creating and registering a + <p>Creating a Wi-Fi P2P application involves creating and registering a broadcast receiver for your application, discovering peers, connecting to a peer, and transferring data to a peer. The following sections describe how to do this.</p> <h3 id="setup">Initial setup</h3> - <p>Before using the Wi-Fi Direct APIs, you must ensure that your application can access - the hardware and that the device supports the Wi-Fi Direct protocol. If Wi-Fi Direct is supported, + <p>Before using the Wi-Fi P2P APIs, you must ensure that your application can access + the hardware and that the device supports the Wi-Fi P2P protocol. If Wi-Fi P2P is supported, you can obtain an instance of {@link android.net.wifi.p2p.WifiP2pManager}, create and register - your broadcast receiver, and begin using the Wi-Fi Direct APIs.</p> + your broadcast receiver, and begin using the Wi-Fi P2P APIs.</p> <ol> <li> <p>Request permission to use the Wi-Fi hardware on the device and also declare @@ -292,10 +295,10 @@ public class WiFiDirectBroadcastReceiver extends BroadcastReceiver { </pre> </li> - <li>Check to see if Wi-Fi Direct is on and supported. A good place to check this is in your + <li>Check to see if Wi-Fi P2P is on and supported. A good place to check this is in your broadcast receiver when it receives the {@link android.net.wifi.p2p.WifiP2pManager#WIFI_P2P_STATE_CHANGED_ACTION} intent. Notify your - activity of the Wi-Fi Direct state and react accordingly: + activity of the Wi-Fi P2P state and react accordingly: <pre> @Override public void onReceive(Context context, Intent intent) { @@ -304,9 +307,9 @@ public void onReceive(Context context, Intent intent) { if (WifiP2pManager.WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) { int state = intent.getIntExtra(WifiP2pManager.EXTRA_WIFI_STATE, -1); if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) { - // Wifi Direct is enabled + // Wifi P2P is enabled } else { - // Wi-Fi Direct is not enabled + // Wi-Fi P2P is not enabled } } ... @@ -315,10 +318,10 @@ public void onReceive(Context context, Intent intent) { </li> <li>In your activity's {@link android.app.Activity#onCreate onCreate()} method, obtain an instance of {@link - android.net.wifi.p2p.WifiP2pManager} and register your application with the Wi-Fi Direct + android.net.wifi.p2p.WifiP2pManager} and register your application with the Wi-Fi P2P framework by calling {@link android.net.wifi.p2p.WifiP2pManager#initialize initialize()}. This method returns a {@link android.net.wifi.p2p.WifiP2pManager.Channel}, which is used to connect - your application to the Wi-Fi Direct framework. You should also create an instance of your + your application to the Wi-Fi P2P framework. You should also create an instance of your broadcast receiver with the {@link android.net.wifi.p2p.WifiP2pManager} and {@link android.net.wifi.p2p.WifiP2pManager.Channel} objects along with a reference to your activity. This allows your broadcast receiver to notify @@ -376,11 +379,11 @@ protected void onPause() { </pre> <p>When you have obtained a {@link android.net.wifi.p2p.WifiP2pManager.Channel} and - set up a broadcast receiver, your application can make Wi-Fi Direct method calls and receive - Wi-Fi Direct intents.</p> + set up a broadcast receiver, your application can make Wi-Fi P2P method calls and receive + Wi-Fi P2P intents.</p> </li> - <p>You can now implement your application and use the Wi-Fi Direct features by calling the + <p>You can now implement your application and use the Wi-Fi P2P features by calling the methods in {@link android.net.wifi.p2p.WifiP2pManager}. The next sections describe how to do common actions such as discovering and connecting to peers.</p> </ol> @@ -492,10 +495,10 @@ mManager.connect(mChannel, config, new ActionListener() { </ol> <p>The following example, modified from the <a href= - "{@docRoot}resources/samples/WiFiDirectDemo/index.html">Wi-Fi Direct Demo</a> sample, shows you how + "{@docRoot}resources/samples/WiFiDirectDemo/index.html">Wi-Fi P2P Demo</a> sample, shows you how to create this client-server socket communication and transfer JPEG images from a client to a server with a service. For a complete working example, compile and run the <a href= - "{@docRoot}resources/samples/WiFiDirectDemo/index.html">Wi-Fi Direct Demo</a> sample.</p> + "{@docRoot}resources/samples/WiFiDirectDemo/index.html">Wi-Fi P2P Demo</a> sample.</p> <pre> public static class FileServerAsyncTask extends AsyncTask<Void, Void, String> { diff --git a/docs/html/guide/topics/manifest/compatible-screens-element.jd b/docs/html/guide/topics/manifest/compatible-screens-element.jd index 9ef44fe..00cbfe5 100644 --- a/docs/html/guide/topics/manifest/compatible-screens-element.jd +++ b/docs/html/guide/topics/manifest/compatible-screens-element.jd @@ -33,14 +33,15 @@ with specific screen configurations and enable filtering for users. Any screen c compatible. Thus, external services (such as Google Play) should not provide the application to devices with such screens.</p> - <p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use this manifest +<p class="caution"><strong>Caution:</strong> Normally, <strong>you should not use this manifest element</strong>. Using this element can dramatically reduce the potential user base for your application, by not allowing users to install your application if they have a device with a screen configuration that you have not listed. You should use it only as a last resort, when the -application absolutely does not work with all screen configurations. Instead of using this element, -you should follow the guide to <a href="{@docRoot}guide/practices/screens_support.html">Supporting -Multiple Screens</a>, in order to provide complete support for multiple screens, by adding -alternative resources for different screen sizes and densities.</p> +application absolutely does not work with specific screen configurations. Instead of using this +element, you should follow the guide to <a href= +"{@docRoot}guide/practices/screens_support.html">Supporting Multiple Screens</a> to +provide scalable support for multiple screens using alternative layouts and bitmaps +for different screen sizes and densities.</p> <p>If you want to set only a minimum screen <em>size</em> for your your application, then you should use the <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">{@code @@ -94,6 +95,10 @@ href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple <li>{@code hdpi}</li> <li>{@code xhdpi}</li> </ul> + <p class="note"><strong>Note:</strong> This attribute currently does not accept + {@code xxhdpi} as a valid value, but you can instead specify {@code 480} + as the value, which is the approximate threshold for xhdpi screens.</p> + <p>For information about the different screen densities, see <a href="{@docRoot}guide/practices/screens_support.html#range">Supporting Multiple Screens</a>.</p> </dd> diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd index 4c11adc..95f62a5 100644 --- a/docs/html/guide/topics/manifest/uses-feature-element.jd +++ b/docs/html/guide/topics/manifest/uses-feature-element.jd @@ -163,8 +163,7 @@ feature</em>, if necessary. </li> <dd>The OpenGL ES version required by the application. The higher 16 bits represent the major number and the lower 16 bits represent the minor number. For example, to specify OpenGL ES version 2.0, you would set the value as -"0x00020000". To specify OpenGL ES 2.1, if/when such a version were made -available, you would set the value as "0x00020001". +"0x00020000", or to specify OpenGL ES 3.0, you would set the value as "0x00030000". <p>An application should specify at most one <code>android:glEsVersion</code> attribute in its manifest. If it specifies more than one, the @@ -183,6 +182,10 @@ that it requires OpenGL ES 2.0.</p> <p>An application that can work with any of several OpenGL ES versions should only specify the numerically lowest version of OpenGL ES that it requires. (It can check at run-time whether a higher level of OpenGL ES is available.)</p> + + <p>For more information about using OpenGL ES, including how to check the supported OpenGL ES +version at runtime, see the <a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL ES</a> +API guide.</p> </dd> </dl> @@ -549,8 +552,8 @@ is sensitive to delays or lag in sound input or output.</td> <td>Bluetooth</td> <td><code>android.hardware.bluetooth</td> <td>The application uses Bluetooth radio features in the device.</td> -<td> -</td> + <td>If your app uses Bluetooth Low Energy, also declare + {@code android.software.bluetooth_le}.</td> </tr> <tr> <td rowspan="5">Camera</td> @@ -846,26 +849,49 @@ in a separate <code><uses-feature></code> element. </p> <th>Feature</th> <th>Attribute Value</th> <th>Description</th> - <th>Comments</th> +</tr> +<tr> + <td>App Widgets</td> + <td><code>android.software.app_widgets</code></td> + <td>The application uses or provides App Widgets and should be installed only on devices + that include a Home screen or similar location where users can embed App Widgets.</td> +</tr> +<tr> + <td>Bluetooth Low Energy</td> + <td><code>android.software.bluetooth_le</code></td> + <td><p>The application uses Bluetooth Low Energy APIs and should be installed only on devices + that are capable of communicating with other devices via Bluetooth Low Energy. + <p>This implicitly also declares the {@code android.hardware.bluetooth} feature.</td> +</tr> +<tr> + <td>Home Screen</td> + <td><code>android.software.home_screen</code></td> + <td>The application behaves as a Home screen replacement and should be installed only on + devices that support third-party Home screen apps.</td> +</tr> +<tr> + <td>Input Method</td> + <td><code>android.software.input_methods</code></td> + <td>The application provides a custom input method and should be installed only on devices that + support third-party input methods.</td> </tr> <tr> <td>Live Wallpaper</td> <td><code>android.software.live_wallpaper</code></td> - <td>The application uses or provides Live Wallpapers.</td> - <td></td> + <td>The application uses or provides Live Wallpapers and should be installed only on devices that + support Live Wallpapers.</td> </tr> <tr> <td rowspan="2">SIP/VOIP</td> <td><code>android.software.sip</code></td> - <td>The application uses SIP service on the device. + <td>The application uses SIP service on the device and should be installed only on devices that + support SIP. </td> - <td></td> </tr> <tr> <td><code>android.software.sip.voip</code></td> - <td>Subfeature. The application uses SIP-based VOIP service on the device. - </td> - <td>This subfeature implicitly declares the <code>android.software.sip</code> parent feature, + <td><p>Subfeature. The application uses SIP-based VOIP service on the device. + <p>This subfeature implicitly declares the <code>android.software.sip</code> parent feature, unless declared with <code>android:required="false"</code>.</td> </tr> </table> diff --git a/docs/html/guide/topics/manifest/uses-sdk-element.jd b/docs/html/guide/topics/manifest/uses-sdk-element.jd index 18e479f..07b08f6 100644 --- a/docs/html/guide/topics/manifest/uses-sdk-element.jd +++ b/docs/html/guide/topics/manifest/uses-sdk-element.jd @@ -1,4 +1,4 @@ -fpage.title=<uses-sdk> +page.title=<uses-sdk> page.tags="api levels","sdk version","minsdkversion","targetsdkversion","maxsdkversion" @jd:body diff --git a/docs/html/guide/topics/providers/content-provider-creating.jd b/docs/html/guide/topics/providers/content-provider-creating.jd index ebd7c25..6ec1e1b 100644 --- a/docs/html/guide/topics/providers/content-provider-creating.jd +++ b/docs/html/guide/topics/providers/content-provider-creating.jd @@ -680,7 +680,7 @@ public class ExampleProvider extends ContentProvider * Notice that the database itself isn't created or opened * until SQLiteOpenHelper.getWritableDatabase is called */ - mOpenHelper = new SQLiteOpenHelper( + mOpenHelper = new MainDatabaseHelper( getContext(), // the application context DBNAME, // the name of the database) null, // uses the default SQLite cursor diff --git a/docs/html/guide/topics/renderscript/compute.jd b/docs/html/guide/topics/renderscript/compute.jd index 607d16e..c62510b 100644 --- a/docs/html/guide/topics/renderscript/compute.jd +++ b/docs/html/guide/topics/renderscript/compute.jd @@ -10,6 +10,11 @@ parent.link=index.html <ol> <li><a href="#writing-an-rs-kernel">Writing a RenderScript Kernel</a></li> + <li><a href="#access-rs-apis">Accessing RenderScript APIs</a> + <ol> + <li><a href="#ide-setup">Setting Up Your Development Environment</a></li> + </ol> + </li> <li><a href="#using-rs-from-java">Using RenderScript from Java Code</a></li> </ol> @@ -144,9 +149,90 @@ different level of floating point precision:</p> beneficial on some architectures due to additional optimizations only available with relaxed precision (such as SIMD CPU instructions).</p> + +<h2 id="access-rs-apis">Accessing RenderScript APIs</h2> + +<p>When developing an Android application that uses RenderScript, you can access its API in + one of two ways:</p> + +<ul> + <li><strong>{@link android.renderscript}</strong> - The APIs in this class package are + available on devices running Android 3.0 (API level 11) and higher. These are the original APIs + for RenderScript and are not currently being updated.</li> + <li><strong>{@link android.support.v8.renderscript}</strong> - The APIs in this package are + available through a <a href="{@docRoot}tools/support-library/features.html#v8">Support + Library</a>, which allows you to use them on devices running Android 2.2 (API level 8) and + higher.</li> +</ul> + +<p>We strongly recommend using the Support Library APIs for accessing RenderScript because they + include the latest improvements to the RenderScript compute framework and provide a wider range + of device compatibility.</p> + + +<h3 id="ide-setup">Using the RenderScript Support Library APIs</h3> + +<p>In order to use the Support Library RenderScript APIs, you must configure your development + environment to be able to access them. The following Android SDK tools are required for using + these APIs:</p> + +<ul> + <li>Android SDK Tools revision 22.2 or higher</li> + <li>Android SDK Build-tools revision 18.1.0 or higher</li> +</ul> + +<p>You can check and update the installed version of these tools in the + <a href="{@docRoot}tools/help/sdk-manager.html">Android SDK Manager</a>.</p> + +<p class="note"> + <strong>Note:</strong> Use of Support Library RenderScript APIs is not currently supported with + Android Studio or Gradle-based builds. +</p> + +<p>To use the Support Library RenderScript APIs in Eclipse:</p> + +<ol> + <li>Make sure you have the required Android SDK version and Build Tools version installed.</li> + <li>Open the {@code project.properties} file in the root folder of your application project.</li> + <li>Add the following lines to the file: +<pre> +renderscript.target=18 +renderscript.support.mode=true +sdk.buildtools=18.1.0 +</pre> + </li> + <li>In your application classes that use RenderScript, add an import for the Support Library + classes: +<pre> +import android.support.v8.renderscript.*; +</pre> + </li> +</ol> + +<p>The {@code project.properties} settings listed above control specific behavior in the Android + build process:</p> + +<ul> + <li>{@code renderscript.target} - Specifies the bytecode version to be generated. We + recommend you set this value the highest available API level and set {@code + renderscript.support.mode} to {@code true}. Valid values for this setting are any integer value + from 11 to the most recently released API level. If your minimum SDK version specified in your + application manifest is set to a higher value, this value is ignored and the target value is set + to the minimum SDK version.</li> + <li>{@code renderscript.support.mode} - Specifies that the generated bytecode should fall + back to a compatible version if the device it is running on does not support the target version. + </li> + <li>{@code sdk.buildtools} - The version of the Android SDK build tools to use. This value + should be set to {@code 18.1.0} or higher. If this option is not specified, the highest + installed build tools version is used. You should always set this value to ensure the + consistency of builds across development machines with different configurations.</li> +</ul> + + <h2 id="using-rs-from-java">Using RenderScript from Java Code</h2> -<p>Using RenderScript from Java code relies on the {@link android.renderscript} APIs. Most +<p>Using RenderScript from Java code relies on the API classes located in the +{@link android.renderscript} or the {@link android.support.v8.renderscript} package. Most applications follow the same basic usage patterns:</p> <ol> diff --git a/docs/html/guide/topics/ui/accessibility/apps.jd b/docs/html/guide/topics/ui/accessibility/apps.jd index 13b4538..da24d03 100644 --- a/docs/html/guide/topics/ui/accessibility/apps.jd +++ b/docs/html/guide/topics/ui/accessibility/apps.jd @@ -351,7 +351,7 @@ following approaches:</p> <li>If your application targets Android 4.0 (API level 14) and higher, override and implement the accessibility methods listed above directly in your custom view class.</li> <li>If your custom view is intended to be compatible with Android 1.6 (API Level 4) and above, add -the Android <a href="{@docRoot}tools/extras/support-library.html">Support Library</a>, revision 5 or +the Android <a href="{@docRoot}tools/support-library/index.html">Support Library</a>, revision 5 or higher, to your project. Then, within your custom view class, call the {@link android.support.v4.view.ViewCompat#setAccessibilityDelegate ViewCompat.setAccessibilityDelegate()} method to implement the accessibility methods @@ -490,7 +490,7 @@ appropriate feedback to users.</p> <p>The example code below shows how override these three methods by using {@link android.support.v4.view.ViewCompat#setAccessibilityDelegate ViewCompat.setAccessibilityDelegate()}. Note that this sample code requires that the Android -<a href="{@docRoot}tools/extras/support-library.html">Support Library</a> for API Level 4 (revision +<a href="{@docRoot}tools/support-library/index.html">Support Library</a> for API Level 4 (revision 5 or higher) is added to your project.</p> <pre> @@ -534,7 +534,7 @@ ViewCompat.setAccessibilityDelegate(new AccessibilityDelegateCompat() { <p>In applications targeting Android 4.0 (API Level 14) and higher, you can implement these methods directly in your custom view class. For another example of this approach, see the Android -<a href="{@docRoot}tools/extras/support-library.html">Support Library</a> (revision 5 or higher) +<a href="{@docRoot}tools/support-library/index.html">Support Library</a> (revision 5 or higher) sample {@code AccessibilityDelegateSupportActivity} in ({@code <sdk>/extras/android/support/v4/samples/Support4Demos/}).</p> @@ -594,7 +594,7 @@ methods.</p> example implementation of this accessibility feature, see {@code AccessibilityNodeProviderActivity} in the ApiDemos sample project. You can implement a virtual view hierarchy that is compatible with Android 1.6 and later by using the - <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> with the + <a href="{@docRoot}tools/support-library/index.html">Support Library</a> with the {@link android.support.v4.view.ViewCompat#getAccessibilityNodeProvider ViewCompat.getAccessibilityNodeProvider()} method and providing an implementation with {@link android.support.v4.view.accessibility.AccessibilityNodeProviderCompat}.</p> diff --git a/docs/html/guide/topics/ui/accessibility/checklist.jd b/docs/html/guide/topics/ui/accessibility/checklist.jd index 9473d1b..960cca2 100644 --- a/docs/html/guide/topics/ui/accessibility/checklist.jd +++ b/docs/html/guide/topics/ui/accessibility/checklist.jd @@ -73,7 +73,7 @@ helps you focus on the key development issues to get the details of accessibilit your application, <a href="{@docRoot}guide/topics/ui/accessibility/apps.html#custom-views"> implement accessibility interfaces</a> for your custom views and provide content descriptions. For custom controls that are intended to be compatible with versions of Android back to 1.6, - use the <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> to implement + use the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> to implement the latest accessibility features.</li> <li><strong>No audio-only feedback:</strong> Audio feedback must always have a secondary feedback mechanism to support users who are deaf or hard of hearing. For example, a sound alert diff --git a/docs/html/guide/topics/ui/accessibility/services.jd b/docs/html/guide/topics/ui/accessibility/services.jd index 2a6fe7a..4bd752f 100644 --- a/docs/html/guide/topics/ui/accessibility/services.jd +++ b/docs/html/guide/topics/ui/accessibility/services.jd @@ -55,7 +55,7 @@ accessibility service.</p> <p>The ability for you to build and deploy accessibility services was introduced with Android 1.6 (API Level 4) and received significant improvements with Android 4.0 (API Level 14). The Android - <a href="{@docRoot}tools/extras/support-library.html">Support Library</a> was also updated with + <a href="{@docRoot}tools/support-library/index.html">Support Library</a> was also updated with the release of Android 4.0 to provide support for these enhanced accessibility features back to Android 1.6. Developers aiming for widely compatible accessibility services are encouraged to use the Support Library and develop for the more advanced accessibility features introduced in @@ -448,7 +448,7 @@ android.accessibilityservice.AccessibilityService} and can be used as a base for accessibility services that are compatible with Android 1.6 (API Level 4) and higher.</li> <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.html">TaskBackService</a> - This service is based on the enhanced accessibility APIs introduced in Android 4.0 (API Level -14). However, you can use the Android <a href="{@docRoot}tools/extras/support-library.html">Support +14). However, you can use the Android <a href="{@docRoot}tools/support-library/index.html">Support Libary</a> to substitute classes introduced in later API levels (e.g., {@link android.view.accessibility.AccessibilityRecord}, {@link android.view.accessibility.AccessibilityNodeInfo} diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd index 453d9d7..3173ff1 100644 --- a/docs/html/guide/topics/ui/actionbar.jd +++ b/docs/html/guide/topics/ui/actionbar.jd @@ -1,7 +1,6 @@ page.title=Action Bar -page.tags="actionbar","menu" -parent.title=User Interface -parent.link=index.html +page.tags="actionbar","menu","tabs" + @jd:body @@ -89,7 +88,7 @@ design guide.</p> <p>The {@link android.app.ActionBar} APIs were first added in Android 3.0 (API level 11) but they are also available in the <a href="{@docRoot}tools/support-library/index.html">Support Library</a> -for compatibility with Android 2.2 (API level 7) and above.</p> +for compatibility with Android 2.1 (API level 7) and above.</p> <p><b>This guide focuses on how to use the support library's action bar</b>, but if your app supports <em>only</em> Android 3.0 or higher, you @@ -133,7 +132,7 @@ Library Setup</a>.</p> </li> </ol> -<p>Now your activity includes the action bar when running on Android 2.2 (API level 7) or higher. +<p>Now your activity includes the action bar when running on Android 2.1 (API level 7) or higher. </p> <div class="note"> @@ -254,11 +253,11 @@ showAsAction="ifRoom"} in the {@code <item>} tag. For example:</p> <pre> <menu xmlns:android="http://schemas.android.com/apk/res/android" - <strong>xmlns:example.app="http://schemas.android.com/apk/res-auto"</strong> > + <strong>xmlns:yourapp="http://schemas.android.com/apk/res-auto"</strong> > <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" - <strong>example.app:showAsAction="ifRoom"</strong> /> + <strong>yourapp:showAsAction="ifRoom"</strong> /> ... </menu> </pre> @@ -282,7 +281,7 @@ want to display the text title, add {@code "withText"} to the {@code showAsActio attribute. For example:</p> <pre> -<item example.app:showAsAction="ifRoom|withText" ... /> +<item yourapp:showAsAction="ifRoom|withText" ... /> </pre> <p class="note"><strong>Note:</strong> The {@code "withText"} value is a <em>hint</em> to the @@ -373,33 +372,29 @@ items on a narrow screen, while leaving room for navigation and title elements a <p>To enable split action bar when using the support library, you must do two things:</p> <ol> - <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to your -<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or + <li>Add {@code uiOptions="splitActionBarWhenNarrow"} to each +<a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> +element or to the <a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a> -manifest element. This attribute is understood only by API level 14 and higher (it is ignored -by older versions). - <li>For older versions, create a custom theme that extends one of the {@link - android.support.v7.appcompat.R.style#Theme_AppCompat Theme.AppCompat} themes, and include - the {@link android.support.v7.appcompat.R.attr#windowSplitActionBar windowSplitActionBar} style - set {@code true}. For example: - <p class="code-caption">res/values/styles.xml</p> - <pre> -<style name="MyAppTheme" parent="Theme.AppCompat.Light"> - <item name="windowSplitActionBar">true<item> -</style> -</pre> +element. This attribute is understood only by API level 14 and higher (it is ignored +by older versions).</li> + <li>To support older versions, add a <a + href="{@docRoot}guide/topics/manifest/meta-data-element.html">{@code <meta-data>}</a> + element as a child of each + <a href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> + element that declares the same value for {@code "android.support.UI_OPTIONS"}.</li> +</ol> - <p>Then set this as your activity theme:</p> +<p>For example:</p> - <p class="code-caption">AndroidManifest.xml</p> - <pre> +<pre> <manifest ...> - <activity android:theme="@style/MyAppTheme" ...> - ... -</manifest ...> + <activity uiOptions="splitActionBarWhenNarrow" ... > + <meta-data android:name="android.support.UI_OPTIONS" + android:value="splitActionBarWhenNarrow" /> + </activity> +</manifest> </pre> - </li> -</ol> <p>Using split action bar also allows <a href="#Tabs">navigation tabs</a> to collapse into the @@ -572,12 +567,12 @@ the {@link android.support.v7.widget.SearchView} widget:</p> <pre> <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:example.app="http://schemas.android.com/apk/res-auto" > + xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_search" android:title="@string/action_search" android:icon="@drawable/ic_action_search" - example.app:showAsAction="ifRoom|collapseActionView" - <b>example.app:actionViewClass="android.support.v7.widget.SearchView"</b> /> + yourapp:showAsAction="ifRoom|collapseActionView" + <b>yourapp:actionViewClass="android.support.v7.widget.SearchView"</b> /> </menu> </pre> @@ -720,11 +715,11 @@ the {@link android.support.v7.widget.ShareActionProvider} class. For example:</p <pre> <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:example.app="http://schemas.android.com/apk/res-auto" > + xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_share" android:title="@string/share" - example.app:showAsAction="ifRoom" - <strong>example.app:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong> + yourapp:showAsAction="ifRoom" + <strong>yourapp:actionProviderClass="android.support.v7.widget.ShareActionProvider"</strong> /> ... </menu> diff --git a/docs/html/guide/topics/ui/controls/checkbox.jd b/docs/html/guide/topics/ui/controls/checkbox.jd index 99140b5..2a64e38 100644 --- a/docs/html/guide/topics/ui/controls/checkbox.jd +++ b/docs/html/guide/topics/ui/controls/checkbox.jd @@ -94,7 +94,7 @@ must have a signature exactly as shown above. Specifically, the method must:</p> android.view.View} that was clicked)</li> </ul> -<p class="note"><strong>Tip:</strong> If you need to change the radio button state +<p class="note"><strong>Tip:</strong> If you need to change the checkbox state yourself (such as when loading a saved {@link android.preference.CheckBoxPreference}), use the {@link android.widget.CompoundButton#setChecked(boolean)} or {@link android.widget.CompoundButton#toggle()} method.</p>
\ No newline at end of file diff --git a/docs/html/guide/topics/ui/controls/pickers.jd b/docs/html/guide/topics/ui/controls/pickers.jd index a0e7afb..4c55840 100644 --- a/docs/html/guide/topics/ui/controls/pickers.jd +++ b/docs/html/guide/topics/ui/controls/pickers.jd @@ -47,11 +47,11 @@ such as in a basic dialog on handsets or as an embedded part of the layout on la <p>Although {@link android.app.DialogFragment} was first added to the platform in Android 3.0 (API level 11), if your app supports versions of Android older than 3.0—even as low as Android 1.6—you can use the {@link android.support.v4.app.DialogFragment} class that's available in -the <a href="{@docRoot}tools/extras/support-library.html">support library</a> for backward +the <a href="{@docRoot}tools/support-library/index.html">support library</a> for backward compatibility.</p> <p class="note"><strong>Note:</strong> The code samples below show how to create dialogs for a time -picker and date picker using the <a href="{@docRoot}tools/extras/support-library.html">support +picker and date picker using the <a href="{@docRoot}tools/support-library/index.html">support library</a> APIs for {@link android.support.v4.app.DialogFragment}. If your app's <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a> is 11 or higher, you can instead use the platform version of {@link android.app.DialogFragment}.</p> @@ -67,7 +67,7 @@ fragment's {@link android.support.v4.app.DialogFragment#onCreateDialog onCreateD <p class="note"><strong>Note:</strong> If your app supports versions of Android older than 3.0, be sure you've set up your Android project with the support library as described in <a -href="{@docRoot}tools/extras/support-library.html#SettingUp">Setting Up a Project to Use a +href="{@docRoot}tools/support-library/setup.html">Setting Up a Project to Use a Library</a>.</p> <h3 id="TimePickerFragment">Extending DialogFragment for a time picker</h3> @@ -172,7 +172,7 @@ fragment's {@link android.support.v4.app.DialogFragment#onCreateDialog onCreateD <p class="note"><strong>Note:</strong> If your app supports versions of Android older than 3.0, be sure you've set up your Android project with the support library as described in <a -href="{@docRoot}tools/extras/support-library.html#SettingUp">Setting Up a Project to Use a +href="{@docRoot}tools/support-library/setup.html">Setting Up a Project to Use a Library</a>.</p> <h3 id="DatePickerFragment">Extending DialogFragment for a date picker</h3> diff --git a/docs/html/guide/topics/ui/declaring-layout.jd b/docs/html/guide/topics/ui/declaring-layout.jd index 6398646..6586c2f 100644 --- a/docs/html/guide/topics/ui/declaring-layout.jd +++ b/docs/html/guide/topics/ui/declaring-layout.jd @@ -359,23 +359,6 @@ partially or totally obscuring them (unless the newer object is transparent). <p>Enables you to specify the location of child objects relative to each other (child A to the left of child B) or to the parent (aligned to the top of the parent).</p> </div> - -<!-- -<div class="layout"> - <h4><a href="layout/tabs.html">Tabs</a></h4> - <a href="layout/tabs.html"><img src="{@docRoot}images/ui/tabs-small.png" alt="" /></a> - <p>Provides a tab selection list that monitors clicks and enables the application to change -the screen whenever a tab is clicked.</p> -</div> - -<div class="layout first"> - <h4><a href="layout/grid.html">Table Layout</a></h4> - <a href="layout/table.html"><img src="{@docRoot}images/ui/gridlayout-small.png" alt="" /></a> - <p>A tabular layout with an arbitrary number of rows and columns, each cell holding the -widget of your choice. The rows resize to fit the largest column. The cell borders are not -visible.</p> -</div> ---> <div class="layout"> <h4><a href="{@docRoot}guide/webapps/webview.html">Web View</a></h4> diff --git a/docs/html/guide/topics/ui/dialogs.jd b/docs/html/guide/topics/ui/dialogs.jd index 7f48eac..d934c4b 100644 --- a/docs/html/guide/topics/ui/dialogs.jd +++ b/docs/html/guide/topics/ui/dialogs.jd @@ -97,7 +97,7 @@ object. If you'd like to create a date or time picker, you should instead read t Because the {@link android.app.DialogFragment} class was originally added with Android 3.0 (API level 11), this document describes how to use the {@link android.support.v4.app.DialogFragment} class that's provided with the <a -href="{@docRoot}tools/extras/support-library.html">Support Library</a>. By adding this library +href="{@docRoot}tools/support-library/index.html">Support Library</a>. By adding this library to your app, you can use {@link android.support.v4.app.DialogFragment} and a variety of other APIs on devices running Android 1.6 or higher. If the minimum version your app supports is API level 11 or higher, then you can use the framework version of {@link @@ -593,7 +593,7 @@ public class NoticeDialogFragment extends DialogFragment { .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // Send the negative button event back to the host activity - mListener.onDialogPositiveClick(NoticeDialogFragment.this); + mListener.onDialogNegativeClick(NoticeDialogFragment.this); } }); return builder.create(); diff --git a/docs/html/guide/topics/ui/how-android-draws.jd b/docs/html/guide/topics/ui/how-android-draws.jd index 6a8cd86..168f77b 100644 --- a/docs/html/guide/topics/ui/how-android-draws.jd +++ b/docs/html/guide/topics/ui/how-android-draws.jd @@ -4,15 +4,19 @@ parent.link=index.html @jd:body -<p>When an Activity receives focus, it will be requested to draw its layout. -The Android framework will handle the procedure for drawing, but the Activity must provide +<p>When an {@link android.app.Activity} receives focus, it will be requested to +draw its layout. +The Android framework will handle the procedure for drawing, but the +{@link android.app.Activity} must provide the root node of its layout hierarchy.</p> <p>Drawing begins with the root node of the layout. It is requested to measure and -draw the layout tree. Drawing is handled by walking the tree and rendering each View that - intersects the invalid region. In turn, each View group is responsible for requesting -each of its children to be drawn (with the <code>{@link android.view.View#draw(Canvas) draw()}</code> method) -and each View is responsible for drawing itself. +draw the layout tree. Drawing is handled by walking the tree and rendering each +{@link android.view.View} that intersects the invalid region. In turn, each +{@link android.view.ViewGroup} is responsible for requesting +each of its children to be drawn +(with the {@link android.view.View#draw(Canvas) draw()} method) +and each {@link android.view.View} is responsible for drawing itself. Because the tree is traversed in-order, this means that parents will be drawn before (i.e., behind) their children, with siblings drawn in the order they appear in the tree. @@ -20,76 +24,107 @@ and each View is responsible for drawing itself. <div class="sidebox-wrapper"> <div class="sidebox"> - <p>The framework will not draw Views that are not in the invalid region, and also - will take care of drawing the Views background for you.</p> - <p>You can force a View to draw, by calling <code>{@link android.view.View#invalidate()}</code>. + <p>The framework will not draw {@link android.view.View} objects that are not +in the invalid region, and also + will take care of drawing the {@link android.view.View} background for you.</p> + <p>You can force a {@link android.view.View} to draw, by calling +{@link android.view.View#invalidate()}. </p> </div> </div> <p> - Drawing the layout is a two pass process: a measure pass and a layout pass. The measuring - pass is implemented in <code>{@link android.view.View#measure(int, int)}</code> and is a top-down traversal - of the View tree. Each View pushes dimension specifications down the tree - during the recursion. At the end of the measure pass, every View has stored + Drawing the layout is a two pass process: a measure pass and a layout pass. +The measuring pass is implemented in {@link android.view.View#measure(int, int)} +and is a top-down traversal of the {@link android.view.View} tree. Each {@link android.view.View} +pushes dimension specifications down the tree + during the recursion. At the end of the measure pass, every +{@link android.view.View} has stored its measurements. The second pass happens in - <code>{@link android.view.View#layout(int,int,int,int)}</code> and is also top-down. During + {@link android.view.View#layout(int,int,int,int)} and is also top-down. During this pass each parent is responsible for positioning all of its children using the sizes computed in the measure pass. </p> <p> - When a View's <code>measure()</code> method returns, its <code>{@link android.view.View#getMeasuredWidth()}</code> and - <code>{@link android.view.View#getMeasuredHeight()}</code> values must be set, along with those for all of - that View's descendants. A View's measured width and measured height values - must respect the constraints imposed by the View's parents. This guarantees + When a {@link android.view.View} object's +{@link android.view.View#measure(int, int) measure()} method +returns, its {@link android.view.View#getMeasuredWidth()} and + {@link android.view.View#getMeasuredHeight()} values must be set, along + with those for all of that {@link android.view.View} object's descendants. +A {@link android.view.View} object's measured width and +measured height values must respect the constraints imposed by the +{@link android.view.View} object's parents. This guarantees that at the end of the measure pass, all parents accept all of their - children's measurements. A parent View may call <code>measure()</code> more than once on + children's measurements. A parent {@link android.view.View} may call +{@link android.view.View#measure(int, int) measure()} more than once on its children. For example, the parent may measure each child once with unspecified dimensions to find out how big they want to be, then call - <code>measure()</code> on them again with actual numbers if the sum of all the children's - unconstrained sizes is too big or too small (i.e., if the children don't agree among themselves - as to how much space they each get, the parent will intervene and set the rules on the second pass). + {@link android.view.View#measure(int, int) measure()} on them again with +actual numbers if the sum of all the children's + unconstrained sizes is too big or too small (that is, if the children +don't agree among themselves + as to how much space they each get, the parent will intervene and set +the rules on the second pass). </p> <div class="sidebox-wrapper"> <div class="sidebox"><p> - To initiate a layout, call <code>{@link android.view.View#requestLayout}</code>. This method is typically - called by a View on itself when it believes that is can no longer fit within + To initiate a layout, call {@link android.view.View#requestLayout}. +This method is typically + called by a {@link android.view.View} on itself +when it believes that is can no longer fit within its current bounds.</p> </div> </div> <p> The measure pass uses two classes to communicate dimensions. The - {@link android.view.ViewGroup.LayoutParams} class is used by Views to tell their parents how they - want to be measured and positioned. The base LayoutParams class just - describes how big the View wants to be for both width and height. For each + {@link android.view.ViewGroup.LayoutParams} class is used by +{@link android.view.View} objects to tell their parents how they + want to be measured and positioned. The base +{@link android.view.ViewGroup.LayoutParams} class just + describes how big the {@link android.view.View} wants to be for both +width and height. For each dimension, it can specify one of:</p> <ul> <li> an exact number - <li><var>FILL_PARENT</var>, which means the View wants to be as big as its parent + <li>{@link android.view.ViewGroup.LayoutParams#MATCH_PARENT MATCH_PARENT}, +which means the {@link android.view.View} wants to be as big as its parent (minus padding)</li> - <li><var>WRAP_CONTENT</var>, which means that the View wants to be just big enough to + <li>{@link android.view.ViewGroup.LayoutParams#WRAP_CONTENT WRAP_CONTENT}, +which means that the {@link android.view.View} wants to be just big enough to enclose its content (plus padding).</li> </ul> - <p>There are subclasses of LayoutParams for different subclasses of ViewGroup. - For example, RelativeLayout has its own subclass of LayoutParams, which includes - the ability to center child Views horizontally and vertically. + <p>There are subclasses of {@link android.view.ViewGroup.LayoutParams} for +different subclasses of {@link android.view.ViewGroup}. + For example, {@link android.widget.RelativeLayout} has its own subclass of +{@link android.view.ViewGroup.LayoutParams}, which includes + the ability to center child {@link android.view.View} objects +horizontally and vertically. </p> <p> - MeasureSpecs are used to push requirements down the tree from parent to - child. A MeasureSpec can be in one of three modes:</p> + {@link android.view.View.MeasureSpec MeasureSpec} objects are used to push +requirements down the tree from parent to + child. A {@link android.view.View.MeasureSpec MeasureSpec} can be in one of +three modes:</p> <ul> - <li><var>UNSPECIFIED</var>: This is used by a parent to determine the desired dimension - of a child View. For example, a LinearLayout may call <code>measure()</code> on its child - with the height set to <var>UNSPECIFIED</var> and a width of <var>EXACTLY</var> 240 to find out how - tall the child View wants to be given a width of 240 pixels.</li> - <li><var>EXACTLY</var>: This is used by the parent to impose an exact size on the + <li>{@link android.view.View.MeasureSpec#UNSPECIFIED UNSPECIFIED}: This is +used by a parent to determine the desired dimension + of a child {@link android.view.View}. For example, a +{@link android.widget.LinearLayout} may call +{@link android.view.View#measure(int, int) measure()} on its child + with the height set to {@link android.view.View.MeasureSpec#UNSPECIFIED UNSPECIFIED} +and a width of {@link android.view.View.MeasureSpec#EXACTLY EXACTLY} 240 to +find out how tall the child {@link android.view.View} wants to be given a +width of 240 pixels.</li> + <li>{@link android.view.View.MeasureSpec#EXACTLY EXACTLY}: This is used +by the parent to impose an exact size on the child. The child must use this size, and guarantee that all of its descendants will fit within this size.</li> - <li><var>AT_MOST</var>: This is used by the parent to impose a maximum size on the + <li>{@link android.view.View.MeasureSpec#AT_MOST AT MOST}: This is used by +the parent to impose a maximum size on the child. The child must guarantee that it and all of its descendants will fit within this size.</li> </ul> diff --git a/docs/html/guide/topics/ui/layout/listview.jd b/docs/html/guide/topics/ui/layout/listview.jd index 6cdd725..f8315c5 100644 --- a/docs/html/guide/topics/ui/layout/listview.jd +++ b/docs/html/guide/topics/ui/layout/listview.jd @@ -48,7 +48,7 @@ displays the results.</p> <p>Although the {@link android.support.v4.content.CursorLoader} APIs were first introduced in Android 3.0 (API level 11), they are also available in the <a -href="{@docRoot}tools/extras/support-library.html">Support Library</a> so that your app may use them +href="{@docRoot}tools/support-library/index.html">Support Library</a> so that your app may use them while supporting devices running Android 1.6 or higher.</p> <p>For more information about using a {@link diff --git a/docs/html/guide/topics/ui/layout/tabs.jd b/docs/html/guide/topics/ui/layout/tabs.jd deleted file mode 100644 index 62663de..0000000 --- a/docs/html/guide/topics/ui/layout/tabs.jd +++ /dev/null @@ -1,219 +0,0 @@ -page.title=Tabbed -parent.title=Layouts -parent.link=layout-objects.html -@jd:body -<div id="qv-wrapper"> -<div id="qv"> -<h2>In this document</h2> - <ol> - <li><a href="#example">Example</a></li> - </ol> - <h2>Key classes</h2> - <ol> -<li>{@link android.widget.TabWidget}</li> -<li>{@link android.widget.TabHost}</li> -<li>{@link android.widget.TabHost.TabSpec}</li> -<li>{@link android.widget.FrameLayout}</li> - </ol> -</div> -</div> -<p>To create a tabbed UI, you need to use a {@link android.widget.TabHost} and a {@link -android.widget.TabWidget}. The {@link android.widget.TabHost} must be the root node for the layout, -which contains both the {@link android.widget.TabWidget} for displaying the tabs and a {@link -android.widget.FrameLayout} for displaying the tab content.</p> - -<img src="{@docRoot}images/ui/tabs.png" alt="" /> - -<p>You can implement your tab content in one of two ways: use the tabs to swap -{@link android.view.View}s within the same {@link android.app.Activity}, or use the tabs to change -between entirely separate activities. Which method you want for your application will depend on your -demands, but if each tab provides a distinct user activity, then it probably makes sense to use -a separate {@link android.app.Activity} for each tab, so that you can better manage the application -in discrete groups, rather than one massive application and layout.</p> -<h2 id="example">Example</h2> -<p>In this tutorial, you'll create a tabbed UI that uses a separate {@link -android.app.Activity} for each tab.</p> - -<ol> - <li>Start a new project named <em>HelloTabWidget</em>.</li> - <li>First, create three separate {@link android.app.Activity} classes in your project: -<code>ArtistsActivity</code>, <code>AlbumsActivity</code>, and <code>SongsActivity</code>. These -will each represent a separate tab. For now, make each one display a simple message using a {@link -android.widget.TextView}. For example: -<pre> -public class ArtistsActivity extends Activity { - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - TextView textview = new TextView(this); - textview.setText("This is the Artists tab"); - setContentView(textview); - } -} -</pre> - <p>Notice that this doesn't use a layout file. Just create a {@link -android.widget.TextView}, give it some text and set that as the content. Duplicate this for -each of the three activities, and add the corresponding <code><activity/></code> tags to the Android Manifest file.</p> - - <li>You need an icon for each of your tabs. For each icon, you should create two versions: one -for when the tab is selected and one for when it is unselected. The -general design recommendation is for the selected icon to be a dark color (grey), and the -unselected icon to be a light color (white). (See the <a -href="{@docRoot}guide/practices/ui_guidelines/icon_design.html#tabstructure">Icon Design -Guidelines</a>.) For example: - <p> - <img src="images/ic_tab_artists_white.png" title="unselected tab icon" alt="" /> - <img src="images/ic_tab_artists_grey.png" title="selected tab icon" alt="" /> - </p> - <p>For this tutorial, you can copy these images and use them for all three tabs. (When you -create tabs in your own application, you should create customized tab icons.)</p> - <p>Now create a <a -href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state-list drawable</a> -that specifies which image to use for each tab state:</p> - <ol> - <li>Save the icon images in your project <code>res/drawable/</code> directory.</li> - <li>Create a new XML file in <code>res/drawable/</code> -named <code>ic_tab_artists.xml</code> and insert the following: -<pre> -<?xml version="1.0" encoding="utf-8"?> -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- When selected, use grey --> - <item android:drawable="@drawable/ic_tab_artists_grey" - android:state_selected="true" /> - <!-- When not selected, use white--> - <item android:drawable="@drawable/ic_tab_artists_white" /> -</selector> -</pre> - <p>This is a <a -href="{@docRoot}guide/topics/resources/drawable-resource.html#StateList">state-list drawable</a>, -which you will apply as the tab image. When the tab state changes, the tab icon will -automatically switch between the images defined here.</p> - </li> - </ol> - </li> - - <li>Open the <code>res/layout/main.xml</code> file and insert the following: - <pre> -<?xml version="1.0" encoding="utf-8"?> -<TabHost xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@android:id/tabhost" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - <LinearLayout - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:padding="5dp"> - <TabWidget - android:id="@android:id/tabs" - android:layout_width="fill_parent" - android:layout_height="wrap_content" /> - <FrameLayout - android:id="@android:id/tabcontent" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:padding="5dp" /> - </LinearLayout> -</TabHost> -</pre> - <p>This is the layout that will display the tabs and provide navigation between each {@link - android.app.Activity} created above.</p> - <p>The {@link android.widget.TabHost} requires that a {@link android.widget.TabWidget} and a -{@link android.widget.FrameLayout} both live somewhere within it. To position the {@link -android.widget.TabWidget} and {@link android.widget.FrameLayout} vertically, a {@link -android.widget.LinearLayout} is used. The {@link android.widget.FrameLayout} is where the content -for each tab goes, which is empty now because the {@link android.widget.TabHost} will automatically -embed each {@link android.app.Activity} within it.</p> - <p>Notice that the {@link android.widget.TabWidget} and the {@link android.widget.FrameLayout} - elements have the IDs {@code tabs} and {@code tabcontent}, respectively. These names - must be used so that the {@link android.widget.TabHost} can retrieve references to each of - them. It expects exactly these names.</p> - </li> - - <li>Now open <code>HelloTabWidget.java</code> and make it extend {@link - android.app.TabActivity}:</p> -<pre> -public class HelloTabWidget extends TabActivity { -</pre> - </li> - <li>Use the following code for the {@link android.app.Activity#onCreate(Bundle) onCreate()} - method: -<pre> -public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - Resources res = getResources(); // Resource object to get Drawables - TabHost tabHost = getTabHost(); // The activity TabHost - TabHost.TabSpec spec; // Resusable TabSpec for each tab - Intent intent; // Reusable Intent for each tab - - // Create an Intent to launch an Activity for the tab (to be reused) - intent = new Intent().setClass(this, ArtistsActivity.class); - - // Initialize a TabSpec for each tab and add it to the TabHost - spec = tabHost.newTabSpec("artists").setIndicator("Artists", - res.getDrawable(R.drawable.ic_tab_artists)) - .setContent(intent); - tabHost.addTab(spec); - - // Do the same for the other tabs - intent = new Intent().setClass(this, AlbumsActivity.class); - spec = tabHost.newTabSpec("albums").setIndicator("Albums", - res.getDrawable(R.drawable.ic_tab_albums)) - .setContent(intent); - tabHost.addTab(spec); - - intent = new Intent().setClass(this, SongsActivity.class); - spec = tabHost.newTabSpec("songs").setIndicator("Songs", - res.getDrawable(R.drawable.ic_tab_songs)) - .setContent(intent); - tabHost.addTab(spec); - - tabHost.setCurrentTab(2); -} -</pre> - <p>This sets up each tab with their text and icon, and assigns each one an {@link -android.app.Activity}.</p> - <p>A reference to the {@link android.widget.TabHost} is first captured with {@link -android.app.TabActivity#getTabHost()}. Then, for -each tab, a {@link android.widget.TabHost.TabSpec} is created to define the tab properties. The -{@link android.widget.TabHost#newTabSpec(String)} method creates a new {@link -android.widget.TabHost.TabSpec} identified by the given string tag. For each -{@link android.widget.TabHost.TabSpec}, {@link -android.widget.TabHost.TabSpec#setIndicator(CharSequence,Drawable)} is called to set the text and -icon for the tab, and {@link android.widget.TabHost.TabSpec#setContent(Intent)} is called to specify -the {@link android.content.Intent} to open the appropriate {@link android.app.Activity}. Each -{@link android.widget.TabHost.TabSpec} is then added to the {@link android.widget.TabHost} by -calling {@link android.widget.TabHost#addTab(TabHost.TabSpec)}.</p> - - <p>At the very end, {@link - android.widget.TabHost#setCurrentTab(int)} opens the tab to be displayed by default, specified - by the index position of the tab.</p> - - <p>Notice that not once was the {@link android.widget.TabWidget} object referenced. This is - because a {@link android.widget.TabWidget} must always be a child of a {@link - android.widget.TabHost}, which is what you use for almost all interaction with the tabs. So when - a tab is added to the {@link android.widget.TabHost}, it's automatically added to the child - {@link android.widget.TabWidget}.</p> - </li> - - <li>Now open the Android Manifest file and add the <code>NoTitleBar</code> theme to the -<em>HelloTabWidget</em>'s - <code><activity></code> tag. This will remove the default application title from the top - of the layout, leaving more space for the tabs, which effectively operate as their own titles. - The <code><activity></code> tag should look like this: -<pre> -<activity android:name=".HelloTabWidget" android:label="@string/app_name" - android:theme="@android:style/Theme.NoTitleBar"> -</pre> - </li> - - <li>Run the application.</li> -</ol> - - -<p>Your application should look like this (though your icons may be different):</p> -<img src="images/hello-tabwidget.png" width="150px" /> - - diff --git a/docs/html/guide/topics/ui/notifiers/notifications.jd b/docs/html/guide/topics/ui/notifiers/notifications.jd index 05ec279..3b1292e 100644 --- a/docs/html/guide/topics/ui/notifiers/notifications.jd +++ b/docs/html/guide/topics/ui/notifiers/notifications.jd @@ -94,7 +94,7 @@ page.title=Notifications <p class="note"> <strong>Note:</strong> Except where noted, this guide refers to the {@link android.support.v4.app.NotificationCompat.Builder NotificationCompat.Builder} class - in the version 4 <a href="{@docRoot}tools/extras/support-library.html">Support Library</a>. + in the version 4 <a href="{@docRoot}tools/support-library/index.html">Support Library</a>. The class {@link android.app.Notification.Builder Notification.Builder} was added in Android 3.0. </p> @@ -285,7 +285,7 @@ page.title=Notifications <p> Starting an {@link android.app.Activity} when the user clicks the notification is the most common action scenario. You can also start an {@link android.app.Activity} when the user - dismisses an {@link android.app.Activity}. In Android 4.1 and later, you can start an + dismisses a notification. In Android 4.1 and later, you can start an {@link android.app.Activity} from an action button. To learn more, read the reference guide for {@link android.support.v4.app.NotificationCompat.Builder}. </p> |
