Scott Main | 1f69439 | 2011-02-21 22:19:27 -0800 | [diff] [blame] | 1 | page.title=Android 3.0 Platform |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 2 | sdk.platform.version=3.0 |
| 3 | sdk.platform.apiLevel=11 |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 4 | @jd:body |
| 5 | |
| 6 | <div id="qv-wrapper"> |
| 7 | <div id="qv"> |
| 8 | |
| 9 | <h2>In this document</h2> |
| 10 | <ol> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 11 | <li><a href="#relnotes">Revisions</a></li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 12 | <li><a href="#api">API Overview</a></li> |
| 13 | <li><a href="#api-level">API Level</a></li> |
| 14 | <li><a href="#apps">Built-in Applications</a></li> |
| 15 | <li><a href="#locs">Locales</a></li> |
| 16 | <li><a href="#skins">Emulator Skins</a></li> |
| 17 | </ol> |
| 18 | |
| 19 | <h2>Reference</h2> |
| 20 | <ol> |
| 21 | <li><a |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 22 | href="{@docRoot}sdk/api_diff/11/changes.html">API |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 23 | Differences Report »</a> </li> |
| 24 | </ol> |
| 25 | |
| 26 | <h2>See Also</h2> |
| 27 | <ol> |
Scott Main | a7b1b8c | 2012-03-14 17:16:11 -0700 | [diff] [blame] | 28 | <li><a href="{@docRoot}guide/practices/tablets-and-handsets.html">Supporting Tablets and |
| 29 | Handsets</a></li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 30 | </ol> |
| 31 | |
| 32 | </div> |
| 33 | </div> |
| 34 | |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 35 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 36 | <p><em>API Level:</em> <strong>{@sdkPlatformApiLevel}</strong></p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 37 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 38 | <p>For developers, the Android {@sdkPlatformVersion} platform is available as a downloadable |
| 39 | component for the Android SDK. The downloadable platform includes an Android library and system |
| 40 | image, as well as a set of emulator skins and more. The downloadable platform includes no external |
| 41 | libraries.</p> |
| 42 | |
| 43 | <p>To get started developing or testing against Android {@sdkPlatformVersion}, use the Android SDK |
| 44 | Manager to download the platform into your SDK. For more information, see <a |
Scott Main | a7b1b8c | 2012-03-14 17:16:11 -0700 | [diff] [blame] | 45 | href="{@docRoot}sdk/adding-components.html">Adding SDK Packages</a>. If you are new to Android, <a |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 46 | href="{@docRoot}sdk/index.html">download the SDK Starter Package</a> first.</p> |
| 47 | |
| 48 | <p>For a high-level introduction to Android {@sdkPlatformVersion}, see the <a |
| 49 | href="{@docRoot}sdk/android-{@sdkPlatformVersion}-highlights.html">Platform |
| 50 | Highlights</a>.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 51 | |
Scott Main | 1f69439 | 2011-02-21 22:19:27 -0800 | [diff] [blame] | 52 | <p class="note"><strong>Note:</strong> |
| 53 | If you've already published an Android application, please test and optimize your application on |
| 54 | Android 3.0 as soon as possible. You should do so to be sure your application provides the best |
| 55 | experience possible on the latest Android-powered devices. For information about what you can do, |
Scott Main | a7b1b8c | 2012-03-14 17:16:11 -0700 | [diff] [blame] | 56 | read <a href="{@docRoot}guide/practices/tablets-and-handsets.html">Supporting Tablets and |
| 57 | Handsets</a>.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 58 | |
| 59 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 60 | <h2 id="relnotes">Revisions</h2> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 61 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 62 | <p>To determine what revision of the Android {@sdkPlatformVersion} platform you have installed, |
| 63 | refer to the "Installed Packages" listing in the Android SDK and AVD Manager.</p> |
| 64 | |
| 65 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 66 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 67 | <div class="toggle-content opened" style="padding-left:1em;"> |
| 68 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 69 | <p><a href="#" onclick="return toggleContent(this)"> |
| 70 | <img src="{@docRoot}assets/images/triangle-opened.png" |
| 71 | class="toggle-content-img" alt="" /> |
| 72 | Android {@sdkPlatformVersion}, Revision 2</a> <em>(July 2011)</em> |
| 73 | </a></p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 74 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 75 | <div class="toggle-content-toggleme" style="padding-left:2em;"> |
| 76 | |
| 77 | <dl> |
| 78 | <dt>Dependencies:</dt> |
| 79 | <dd> |
| 80 | <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or |
| 81 | higher.</p> |
| 82 | </dd> |
| 83 | <dt>Notes:</dt> |
| 84 | <dd> |
| 85 | <p>Improvements to the platform's rendering library to support the visual layout editor in the ADT |
| 86 | Eclipse plugin. This revision allows for more drawing features in ADT and fixes several |
| 87 | bugs in the previous rendering library. It also unlocks several editor features that were added in |
| 88 | ADT 12.</p> |
| 89 | </dd> |
| 90 | </dl> |
| 91 | |
| 92 | </div> |
| 93 | </div> |
| 94 | |
| 95 | <div class="toggle-content closed" style="padding-left:1em;"> |
| 96 | |
| 97 | <p><a href="#" onclick="return toggleContent(this)"> |
| 98 | <img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img" alt="" /> |
| 99 | Android {@sdkPlatformVersion}, Revision 1</a> <em>(February 2011)</em> |
| 100 | </a></p> |
| 101 | |
| 102 | <div class="toggle-content-toggleme" style="padding-left:2em;"> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 103 | |
| 104 | <dl> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 105 | <dt>Dependencies:</dt> |
| 106 | <dd> |
| 107 | <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r10</a> or higher.</p> |
| 108 | </dd> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 109 | </dl> |
| 110 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 111 | </div> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 112 | </div> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 113 | |
| 114 | |
| 115 | |
| 116 | <h2 id="#api">API Overview</h2> |
| 117 | |
| 118 | <p>The sections below provide a technical overview of what's new for developers in Android 3.0, |
| 119 | including new features and changes in the framework API since the previous version.</p> |
| 120 | |
| 121 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 122 | |
| 123 | |
| 124 | |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 125 | <h3>Fragments</h3> |
| 126 | |
| 127 | <p>A fragment is a new framework component that allows you to separate distinct elements of an |
| 128 | activity into self-contained modules that define their own UI and lifecycle. To create a |
| 129 | fragment, you must extend the {@link android.app.Fragment} class and implement several lifecycle |
| 130 | callback methods, similar to an {@link android.app.Activity}. You can then combine multiple |
| 131 | fragments in a single activity to build a multi-pane UI in which each |
| 132 | pane manages its own lifecycle and user inputs.</p> |
| 133 | |
| 134 | <p>You can also use a fragment without providing a UI and instead use the fragment as a worker |
| 135 | for the activity, such as to manage the progress of a download that occurs only while the |
| 136 | activity is running.</p> |
| 137 | |
| 138 | <p>Additionally:</p> |
| 139 | |
| 140 | <ul> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 141 | <li>Fragments are self-contained and you can reuse them in multiple activities</li> |
| 142 | <li>You can add, remove, replace and animate fragments inside the activity</li> |
| 143 | <li>You can add fragments to a back stack managed by the activity, preserving the state of |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 144 | fragments as they are changed and allowing the user to navigate backward through the different |
| 145 | states</li> |
| 146 | <li>By <a |
| 147 | href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">providing |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 148 | alternative layouts</a>, you can mix and match fragments, based |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 149 | on the screen size and orientation</li> |
| 150 | <li>Fragments have direct access to their container activity and can contribute items to the |
| 151 | activity's Action Bar (discussed next)</li> |
| 152 | </ul> |
| 153 | |
| 154 | <p>To manage the fragments in your activity, you must use the {@link |
| 155 | android.app.FragmentManager}, which provides several APIs for interacting with fragments, such |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 156 | as finding fragments in the activity and popping fragments off the back stack to restore their |
| 157 | previous state.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 158 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 159 | <p>To perform a transaction, such as add or remove a fragment, you must create a {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 160 | android.app.FragmentTransaction}. You can then call methods such as {@link |
| 161 | android.app.FragmentTransaction#add add()} {@link android.app.FragmentTransaction#remove |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 162 | remove()}, or {@link android.app.FragmentTransaction#replace replace()}. Once you've applied all |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 163 | the changes you want to perform for the transaction, you must call {@link |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 164 | android.app.FragmentTransaction#commit commit()} and the system applies the fragment transaction to |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 165 | the activity.</p> |
| 166 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 167 | <p>For more information about using fragments, read the <a |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 168 | href="{@docRoot}guide/topics/fundamentals/fragments.html">Fragments</a> documentation. Several |
| 169 | samples are also available in the <a |
| 170 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment"> |
| 171 | API Demos</a> application.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | <h3>Action Bar</h3> |
| 177 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 178 | <p>The Action Bar is a replacement for the traditional title bar at the top of the activity window. |
| 179 | It includes the application logo in the left corner and provides a new interface for items in the |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 180 | <a href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a>. Additionally, the |
| 181 | Action Bar allows you to:</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 182 | |
| 183 | <ul> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 184 | <li>Add menu items directly in the Action Bar—as "action items." |
| 185 | <p>In your XML declaration for the menu item, include the {@code |
| 186 | android:showAsAction} attribute with a value of {@code "ifRoom"}. When there's enough room, the menu |
| 187 | item appears directly in the Action Bar. Otherwise, the item is placed in the |
| 188 | overflow menu, revealed by the menu icon on the right side of the Action Bar.</p></li> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 189 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 190 | <li>Replace an action item with a widget (such as a search box)—creating an |
| 191 | "action view." |
| 192 | <p>In the XML declaration for the menu item, add the {@code android:actionViewLayout} attribute |
| 193 | with a layout resource or the {@code android:actionViewClass} attribute with the class name of a |
| 194 | widget. (You must also declare the {@code android:showAsAction} attribute so that the item appears |
| 195 | in the Action Bar.) If there's not enough room in the Action Bar and the item appears in the |
| 196 | overflow menu, it behaves like a regular menu item and does not show the widget.</p></li> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 197 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 198 | <li>Add an action to the application logo and replace it with a custom logo |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 199 | <p>The application logo is automatically assigned the {@code android.R.id.home} ID, |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 200 | which the system delivers to your activity's {@link android.app.Activity#onOptionsItemSelected |
| 201 | onOptionsItemSelected()} callback when touched. Simply respond to this ID in your callback |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 202 | method to perform an action such as go to your application's "home" activity.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 203 | <p>To replace the icon with a logo, specify your application logo in the manifest file with the |
| 204 | <a href="{@docRoot}guide/topics/manifest/application-element.html#logo">{@code android:logo}</a> |
| 205 | attribute, then call {@link android.app.ActionBar#setDisplayUseLogoEnabled |
| 206 | setDisplayUseLogoEnabled(true)} in your activity.</p></li> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 207 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 208 | <li>Add breadcrumbs to navigate backward through the back stack of fragments</li> |
| 209 | <li>Add tabs or a drop-down list to navigate through fragments</li> |
| 210 | <li>Customize the Action Bar with themes and backgrounds</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 211 | </ul> |
| 212 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 213 | <p>The Action Bar is standard for all applications that use the new holographic theme, which is |
| 214 | also standard when you set either the <a |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 215 | href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code |
| 216 | android:minSdkVersion}</a> or <a |
| 217 | href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 218 | android:targetSdkVersion}</a> to {@code "11"}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 219 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 220 | <p>For more information about the Action Bar, read the <a |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 221 | href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> documentation. Several |
| 222 | samples are also available in the <a |
| 223 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#ActionBar"> |
| 224 | API Demos</a> application.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | <h3>System clipboard</h3> |
| 230 | |
| 231 | <p>Applications can now copy and paste data (beyond mere text) to and from the system-wide |
| 232 | clipboard. Clipped data can be plain text, a URI, or an intent.</p> |
| 233 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 234 | <p>By providing the system access to the data you want the user to copy, through a content provider, |
| 235 | the user can copy complex content (such as an image or data structure) from your application and |
| 236 | paste it into another application that supports that type of content.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 237 | |
| 238 | <p>To start using the clipboard, get the global {@link android.content.ClipboardManager} object |
| 239 | by calling {@link android.content.Context#getSystemService getSystemService(CLIPBOARD_SERVICE)}.</p> |
| 240 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 241 | <p>To copy an item to the clipboard, you need to create a new {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 242 | android.content.ClipData} object, which holds one or more {@link android.content.ClipData.Item} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 243 | objects, each describing a single entity. To create a {@link android.content.ClipData} object |
| 244 | containing just one {@link android.content.ClipData.Item}, you can use one of the helper methods, |
| 245 | such as {@link android.content.ClipData#newPlainText newPlainText()}, {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 246 | android.content.ClipData#newUri newUri()}, and {@link android.content.ClipData#newIntent |
| 247 | newIntent()}, which each return a {@link android.content.ClipData} object pre-loaded with the |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 248 | {@link android.content.ClipData.Item} you provide.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 249 | |
| 250 | <p>To add the {@link android.content.ClipData} to the clipboard, pass it to {@link |
| 251 | android.content.ClipboardManager#setPrimaryClip setPrimaryClip()} for your instance of {@link |
| 252 | android.content.ClipboardManager}.</p> |
| 253 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 254 | <p>You can then read a file from the clipboard (in order to paste it) by calling {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 255 | android.content.ClipboardManager#getPrimaryClip()} on the {@link |
| 256 | android.content.ClipboardManager}. Handling the {@link android.content.ClipData} you receive can |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 257 | be complicated and you need to be sure you can actually handle the data type in the clipboard |
| 258 | before attempting to paste it.</p> |
| 259 | |
| 260 | <p>The clipboard holds only one piece of clipped data (a {@link android.content.ClipData} |
| 261 | object) at a time, but one {@link android.content.ClipData} can contain multiple {@link |
| 262 | android.content.ClipData.Item}s.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 263 | |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 264 | <p>For more information, read the <a href="{@docRoot}guide/topics/clipboard/copy-paste.html">Copy |
| 265 | and Paste</a> documentation. You can also see a simple implementation of copy and paste in the <a |
Scott Main | cd1b08e | 2011-12-27 16:22:27 -0800 | [diff] [blame] | 266 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.html">API Demos</a> |
| 267 | and a more complete implementation in the <a |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 268 | href="{@docRoot}resources/samples/NotePad/index.html">Note Pad</a> application.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | <h3>Drag and drop</h3> |
| 274 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 275 | <p>New APIs simplify drag and drop operations in your application's user interface. A drag |
| 276 | operation is the transfer of some kind of data—carried in a {@link android.content.ClipData} |
| 277 | object—from one place to another. The start and end point for the drag operation is a {@link |
| 278 | android.view.View}, so the APIs that directly handle the drag and drop operations are |
| 279 | in the {@link android.view.View} class.</p> |
| 280 | |
| 281 | <p>A drag and drop operation has a lifecycle that's defined by several drag actions—each |
| 282 | defined by a {@link android.view.DragEvent} object—such as {@link |
| 283 | android.view.DragEvent#ACTION_DRAG_STARTED}, {@link android.view.DragEvent#ACTION_DRAG_ENTERED}, and |
| 284 | {@link android.view.DragEvent#ACTION_DROP}. Each view that wants to participate in a drag |
| 285 | operation can listen for these actions.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 286 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 287 | <p>To begin dragging content in your activity, call {@link android.view.View#startDrag startDrag()} |
| 288 | on a {@link android.view.View}, providing a {@link android.content.ClipData} object that represents |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 289 | the data to drag, a {@link android.view.View.DragShadowBuilder} to facilitate the "shadow" |
| 290 | that users see under their fingers while dragging, and an {@link java.lang.Object} that can share |
| 291 | information about the drag object with views that may receive the object.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 292 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 293 | <p>To accept a drag object in a {@link android.view.View} (receive the "drop"), register the view |
| 294 | with an {@link android.view.View.OnDragListener OnDragListener} by calling {@link |
| 295 | android.view.View#setOnDragListener setOnDragListener()}. When a drag event occurs on the view, the |
| 296 | system calls {@link android.view.View.OnDragListener#onDrag onDrag()} for the {@link |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 297 | android.view.View.OnDragListener OnDragListener}, which receives a {@link android.view.DragEvent} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 298 | describing the type of drag action has occurred (such as {@link |
| 299 | android.view.DragEvent#ACTION_DRAG_STARTED}, {@link android.view.DragEvent#ACTION_DRAG_ENTERED}, and |
| 300 | {@link android.view.DragEvent#ACTION_DROP}). During a drag, the system repeatedly calls {@link |
| 301 | android.view.View.OnDragListener#onDrag onDrag()} for the view underneath the drag, to deliver a |
| 302 | stream of drag events. The receiving view can inquire the event type delivered to {@link |
| 303 | android.view.View#onDragEvent onDragEvent()} by calling {@link android.view.DragEvent#getAction |
| 304 | getAction()} on the {@link android.view.DragEvent}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 305 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 306 | <p class="note"><strong>Note:</strong> Although a drag event may carry a {@link |
| 307 | android.content.ClipData} object, this is not related to the system clipboard. A drag and drop |
| 308 | operation should never put the dragged data in the system clipboard.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 309 | |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 310 | <p>For more information, read the <a href="{@docRoot}guide/topics/ui/drag-drop.html">Dragging and |
| 311 | Dropping</a> documentation. You can also see an implementation of drag and drop in the <a |
| 312 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/DragAndDropDemo.html"> |
| 313 | API Demos</a> application and the <a |
| 314 | href="{@docRoot}resources/samples/HoneycombGallery/index.html">Honeycomb Gallery</a> |
| 315 | application.</p> |
| 316 | |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 317 | |
| 318 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 319 | <h3>App widgets</h3> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 320 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 321 | <p>Android 3.0 supports several new widget classes for more interactive app widgets on the users |
| 322 | Home screen, including: {@link android.widget.GridView}, {@link android.widget.ListView}, {@link |
| 323 | android.widget.StackView}, {@link android.widget.ViewFlipper}, and {@link |
| 324 | android.widget.AdapterViewFlipper}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 325 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 326 | <p>More importantly, you can use the new {@link android.widget.RemoteViewsService} to create app |
| 327 | widgets with collections, using widgets such as {@link android.widget.GridView}, {@link |
| 328 | android.widget.ListView}, and {@link android.widget.StackView} that are backed by remote data, |
| 329 | such as from a content provider.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 330 | |
Scott Main | 5a44efb | 2011-02-15 10:45:46 -0800 | [diff] [blame] | 331 | <p>The {@link android.appwidget.AppWidgetProviderInfo} class (defined in XML with an {@code |
| 332 | <appwidget-provider>} element) also supports two new fields: {@link |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 333 | android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} and {@link |
| 334 | android.appwidget.AppWidgetProviderInfo#previewImage}. The {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 335 | android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} field lets you specify the view ID of the |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 336 | app widget subview that should be auto-advanced by the app widget’s host. The |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 337 | {@link android.appwidget.AppWidgetProviderInfo#previewImage} field specifies a preview of what the |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 338 | app widget looks like and is shown to the user from the widget picker. If this field is not |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 339 | supplied, the app widget's icon is used for the preview.</p> |
| 340 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 341 | <p>To help create a preview image for your app widget (to specify in the {@link |
Scott Main | 48c187f | 2011-04-21 17:22:54 -0700 | [diff] [blame] | 342 | android.appwidget.AppWidgetProviderInfo#previewImage} field), the Android emulator includes an |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 343 | application called "Widget Preview." To create a preview image, launch this application, select the |
| 344 | app widget for your application and set it up how you'd like your preview image to appear, then save |
| 345 | it and place it in your application's drawable resources.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 346 | |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 347 | <p>You can see an implementation of the new app widget features in the <a |
| 348 | href="{@docRoot}resources/samples/StackWidget/index.html">StackView App Widget</a> and <a |
| 349 | href="{@docRoot}resources/samples/WeatherListWidget/index.html">Weather List Widget</a> |
| 350 | applications.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 351 | |
| 352 | |
| 353 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 354 | <h3>Status bar notifications</h3> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 355 | |
| 356 | <p>The {@link android.app.Notification} APIs have been extended to support more content-rich status |
| 357 | bar notifications, plus a new {@link android.app.Notification.Builder} class allows you to easily |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 358 | create {@link android.app.Notification} objects.</p> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 359 | <p>New features include:</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 360 | <ul> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 361 | <li>Support for a large icon in the notification, using {@link |
| 362 | android.app.Notification.Builder#setLargeIcon setLargeIcon()}. This is usually for |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 363 | social applications to show the contact photo of the person who is the source of the |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 364 | notification or for media apps to show an album thumbnail.</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 365 | <li>Support for custom layouts in the status bar ticker, using {@link |
| 366 | android.app.Notification.Builder#setTicker(CharSequence,RemoteViews) setTicker()}.</li> |
| 367 | <li>Support for custom notification layouts to include buttons with {@link |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 368 | android.app.PendingIntent}s, for more interactive notification widgets. For example, a |
| 369 | notification can control music playback without starting an activity.</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 370 | </ul> |
| 371 | |
| 372 | |
| 373 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 374 | <h3>Content loaders</h3> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 375 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 376 | <p>New framework APIs facilitate asynchronous loading of data using the {@link |
| 377 | android.content.Loader} class. You can use it in combination with UI components such as views and |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 378 | fragments to dynamically load data from worker threads. The {@link |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 379 | android.content.CursorLoader} subclass is specially designed to help you do so for data backed by |
| 380 | a {@link android.content.ContentProvider}.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 381 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 382 | <p>All you need to do is implement the {@link android.app.LoaderManager.LoaderCallbacks |
| 383 | LoaderCallbacks} interface to receive callbacks when a new loader is requested or the data has |
| 384 | changed, then call {@link android.app.LoaderManager#initLoader initLoader()} to initialize the |
| 385 | loader for your activity or fragment.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 386 | |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 387 | <p>For more information, read the <a |
Scott Main | a564745 | 2011-02-15 17:25:26 -0800 | [diff] [blame] | 388 | href="{@docRoot}guide/topics/fundamentals/loaders.html">Loaders</a> documentation. You can also see |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 389 | example code using loaders in the <a |
Scott Main | cd1b08e | 2011-12-27 16:22:27 -0800 | [diff] [blame] | 390 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderCursor.html">LoaderCursor</a> |
Scott Main | 13033ea | 2011-02-15 13:18:30 -0800 | [diff] [blame] | 391 | and <a |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 392 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html"> |
| 393 | LoaderThrottle</a> samples.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 394 | |
| 395 | |
| 396 | |
| 397 | <h3>Bluetooth A2DP and headset APIs</h3> |
| 398 | |
| 399 | <p>Android now includes APIs for applications to verify the state of connected Bluetooth A2DP and |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 400 | headset profile devices. For example, applications can identify when a Bluetooth headset is |
| 401 | connected for listening to music and notify the user as appropriate. Applications can also receive |
| 402 | broadcasts for vendor specific AT commands and notify the user about the state of the connected |
| 403 | device, such as when the connected device's battery is low.</p> |
| 404 | |
| 405 | <p>You can initialize the respective {@link android.bluetooth.BluetoothProfile} by calling {@link |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 406 | android.bluetooth.BluetoothAdapter#getProfileProxy getProfileProxy()} with either the {@link |
| 407 | android.bluetooth.BluetoothProfile#A2DP} or {@link android.bluetooth.BluetoothProfile#HEADSET} |
| 408 | profile constant and a {@link android.bluetooth.BluetoothProfile.ServiceListener} to receive |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 409 | callbacks when the Bluetooth client is connected or disconnected.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 410 | |
| 411 | |
| 412 | |
| 413 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 414 | <h3 id="animation">Animation framework</h3> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 415 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 416 | <p>An all new flexible animation framework allows you to animate arbitrary properties of any object |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 417 | (View, Drawable, Fragment, Object, or anything else). It allows you to define several aspects of an |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 418 | animation, such as:</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 419 | <ul> |
| 420 | <li>Duration</li> |
| 421 | <li>Repeat amount and behavior</li> |
| 422 | <li>Type of time interpolation</li> |
| 423 | <li>Animator sets to play animations together, sequentially, or after specified delays</li> |
| 424 | <li>Frame refresh delay</li> |
| 425 | </ul> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 426 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 427 | <p>You can define these animation aspects, and others, for an object's int, float, and hexadecimal |
| 428 | color values, by default. That is, when an object has a property field for one of these types, you |
| 429 | can change its value over time to affect an animation. To animate any other type of value, you tell |
| 430 | the system how to calculate the values for that given type, by implementing the {@link |
| 431 | android.animation.TypeEvaluator} interface.</p> |
| 432 | |
| 433 | <p>There are two animators you can use to animate the values of a property: {@link |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 434 | android.animation.ValueAnimator} and {@link android.animation.ObjectAnimator}. The {@link |
| 435 | android.animation.ValueAnimator} computes the animation values, but is not aware of the specific |
| 436 | object or property that is animated as a result. It simply performs the calculations, and you must |
| 437 | listen for the updates and process the data with your own logic. The {@link |
| 438 | android.animation.ObjectAnimator} is a subclass of {@link android.animation.ValueAnimator} and |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 439 | allows you to set the object and property to animate, and it handles all animation work. |
| 440 | That is, you give the {@link android.animation.ObjectAnimator} the object to animate, the |
| 441 | property of the object to change over time, and a set of values to apply to the property over |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 442 | time, then start the animation.</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 443 | |
| 444 | <p>Additionally, the {@link android.animation.LayoutTransition} class enables automatic transition |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 445 | animations for changes you make to your activity layout. To enable transitions for part of the |
| 446 | layout, create a {@link android.animation.LayoutTransition} object and set it on |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 447 | any {@link android.view.ViewGroup} by calling {@link |
| 448 | android.view.ViewGroup#setLayoutTransition setLayoutTransition()}. This causes default |
| 449 | animations to run whenever items are added to or removed from the group. To specify custom |
| 450 | animations, call {@link android.animation.LayoutTransition#setAnimator setAnimator()} on the {@link |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 451 | android.animation.LayoutTransition} and provide a custom {@link android.animation.Animator}, |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 452 | such as a {@link android.animation.ValueAnimator} or {@link android.animation.ObjectAnimator} |
| 453 | discussed above.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 454 | |
| 455 | <p>For more information, see the <a |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 456 | href="{@docRoot}guide/topics/graphics/animation.html">Property Animation</a> documentation. You can |
| 457 | also see several samples using the animation APIs in the <a |
| 458 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API |
| 459 | Demos</a> application.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 460 | |
| 461 | |
| 462 | |
| 463 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 464 | <h3>Extended UI framework</h3> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 465 | |
| 466 | <ul> |
| 467 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 468 | <li><b>Multiple-choice selection for ListView and GridView</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 469 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 470 | <p>New {@link android.widget.AbsListView#CHOICE_MODE_MULTIPLE_MODAL} mode for {@link |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 471 | android.widget.AbsListView#setChoiceMode setChoiceMode()} allows users to select multiple items |
| 472 | from a {@link android.widget.ListView} or {@link android.widget.GridView}. When used in |
| 473 | conjunction with the Action Bar, users can select multiple items and then select the action to |
| 474 | perform from a list of options in the Action Bar (which has transformed into a Multi-choice |
| 475 | Action Mode).</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 476 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 477 | <p>To enable multiple-choice selection, call {@link |
| 478 | android.widget.AbsListView#setChoiceMode setChoiceMode(CHOICE_MODE_MULTIPLE_MODAL)} and register a |
| 479 | {@link android.widget.AbsListView.MultiChoiceModeListener MultiChoiceModeListener} with {@link |
| 480 | android.widget.AbsListView#setMultiChoiceModeListener setMultiChoiceModeListener()}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 481 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 482 | <p>When the user performs a long-press on an item, the Action Bar switches to the Multi-choice |
| 483 | Action Mode. The system notifies the {@link android.widget.AbsListView.MultiChoiceModeListener |
| 484 | MultiChoiceModeListener} when items are selected by calling {@link |
| 485 | android.widget.AbsListView.MultiChoiceModeListener#onItemCheckedStateChanged |
| 486 | onItemCheckedStateChanged()}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 487 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 488 | <p>For an example of multiple-choice selection, see the <a |
| 489 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/List15.html">List15. |
| 490 | java</a> |
| 491 | class in the API Demos sample application.</p> |
| 492 | </li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 493 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 494 | |
| 495 | <li><b>New APIs to transform views</b> |
| 496 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 497 | <p>New APIs allow you to easily apply 2D and 3D transformations to views in your activity |
| 498 | layout. New transformations are made possible with a set of object properties that define the view's |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 499 | layout position, orientation, transparency and more.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 500 | <p>New methods to set the view properties include: {@link android.view.View#setAlpha |
| 501 | setAlpha()}, {@link |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 502 | android.view.View#setBottom setBottom()}, {@link android.view.View#setLeft setLeft()}, {@link |
| 503 | android.view.View#setRight setRight()}, {@link android.view.View#setBottom setBottom()}, {@link |
| 504 | android.view.View#setPivotX setPivotX()}, {@link android.view.View#setPivotY setPivotY()}, {@link |
| 505 | android.view.View#setRotationX setRotationX()}, {@link android.view.View#setRotationY |
| 506 | setRotationY()}, {@link android.view.View#setScaleX setScaleX()}, {@link android.view.View#setScaleY |
| 507 | setScaleY()}, {@link android.view.View#setAlpha setAlpha()}, and others.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 508 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 509 | <p>Some methods also have a corresponding XML attribute that you can specify in your layout |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 510 | file, to apply a default transformation. Available attributes include: {@code translationX}, {@code |
| 511 | translationY}, {@code rotation}, |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 512 | {@code rotationX}, {@code rotationY}, {@code scaleX}, {@code scaleY}, {@code transformPivotX}, |
| 513 | {@code transformPivotY}, and {@code alpha}.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 514 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 515 | <p>Using some of these new view properties in combination with the new <a |
| 516 | href="#animation">animation framework</a> (discussed |
| 517 | above), you can easily apply some fancy animations to your views. For example, to rotate a |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 518 | view on its y-axis, supply {@link android.animation.ObjectAnimator} with the {@link |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 519 | android.view.View}, the "rotationY" property, and the start and end values:</p> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 520 | <pre> |
| 521 | ObjectAnimator animator = ObjectAnimator.ofFloat(myView, "rotationY", 0, 360); |
| 522 | animator.setDuration(2000); |
| 523 | animator.start(); |
| 524 | </pre> |
| 525 | </li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 526 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 527 | |
| 528 | <li><b>New holographic themes</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 529 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 530 | <p>The standard system widgets and overall look have been redesigned and incorporate a new |
| 531 | "holographic" user interface theme. The system applies the new theme |
| 532 | using the standard <a href="{@docRoot}guide/topics/ui/themes.html">style and theme</a> system.</p> |
| 533 | |
| 534 | <p>Any application that targets the Android 3.0 platform—by setting either the <a |
| 535 | href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a> |
| 536 | or <a |
| 537 | href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code |
| 538 | android:targetSdkVersion}</a> value to {@code "11"}—inherits the holographic theme by default. |
| 539 | However, if your application also applies its own theme, then your theme will override the |
| 540 | holographic theme, unless you update your styles to inherit the holographic theme.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 541 | |
| 542 | <p>To apply the holographic theme to individual activities or to inherit them in your own theme |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 543 | definitions, use one of several new {@link android.R.style#Theme_Holo Theme.Holo} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 544 | themes. If your application is compatible with version of Android lower than 3.0 and applies |
| 545 | custom themes, then you should <a |
| 546 | href="{@docRoot}guide/topics/ui/themes.html#SelectATheme">select a theme based on platform |
| 547 | version</a>.</p> |
| 548 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 549 | </li> |
| 550 | |
| 551 | |
| 552 | <li><b>New widgets</b> |
| 553 | |
| 554 | <ul> |
| 555 | <li>{@link android.widget.AdapterViewAnimator} |
| 556 | <p>Base class for an {@link android.widget.AdapterView} that performs animations when switching |
| 557 | between its views.</p></li> |
| 558 | |
| 559 | <li>{@link android.widget.AdapterViewFlipper} |
| 560 | <p>Simple {@link android.widget.ViewAnimator} that animates between two or more views that have |
| 561 | been added to it. Only one child is shown at a time. If requested, it can automatically flip |
| 562 | between |
| 563 | each child at a regular interval.</p></li> |
| 564 | |
| 565 | <li>{@link android.widget.CalendarView} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 566 | <p>Allows users to select dates from a calendar by touching the date and can scroll or fling the |
| 567 | calendar to a desired date. You can configure the range of dates available in the widget.</p></li> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 568 | |
| 569 | <li>{@link android.widget.ListPopupWindow} |
| 570 | <p>Anchors itself to a host view and displays a list of choices, such as for a list of |
| 571 | suggestions when typing into an {@link android.widget.EditText} view.</p></li> |
| 572 | |
| 573 | <li>{@link android.widget.NumberPicker} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 574 | <p>Enables the user to select a number from a predefined range. The widget presents an input |
| 575 | field and up and down buttons for selecting a number. Touching the input field allows the user to |
| 576 | scroll through values or touch again to directly edit the current value. It also allows you to map |
| 577 | positions to strings, so that the corresponding string is displayed instead of the index |
| 578 | position.</p></li> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 579 | |
| 580 | <li>{@link android.widget.PopupMenu} |
| 581 | <p>Displays a {@link android.view.Menu} in a modal popup window that's anchored to a view. The |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 582 | popup appears below the anchor view if there is room, or above it if there is not. If the IME (soft |
| 583 | keyboard) is visible, the popup does not overlap the IME it until the user touches the |
| 584 | menu.</p></li> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 585 | |
| 586 | <li>{@link android.widget.SearchView} |
Scott Main | abdf0d5 | 2011-02-08 10:20:27 -0800 | [diff] [blame] | 587 | <p>Provides a search box that you can configure to deliver search queries to a specified |
| 588 | activity and display search suggestions (in the same manner as the traditional search dialog). This |
| 589 | widget is particularly useful for offering a search widget in the Action Bar. For more information, |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 590 | see <a href="{@docRoot}guide/topics/search/search-dialog.html">Creating a Search Interface.</p></li> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 591 | |
| 592 | <li>{@link android.widget.StackView} |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 593 | <p>A view that displays its children in a 3D stack and allows users to swipe through |
| 594 | views like a rolodex.</p></li> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 595 | |
| 596 | </ul> |
| 597 | </li> |
| 598 | |
| 599 | </ul> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 600 | |
| 601 | |
| 602 | |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 603 | <h3>Graphics</h3> |
| 604 | |
| 605 | <ul> |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 606 | <li><b>Hardware accelerated 2D graphics</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 607 | |
| 608 | <p>You can now enable the OpenGL renderer for your application by setting {@code |
| 609 | android:hardwareAccelerated="true"} in your manifest element's <a |
| 610 | href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a> |
| 611 | element or for individual <a |
| 612 | href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> |
| 613 | elements.</p> |
| 614 | |
| 615 | <p>This flag helps applications by making them draw faster. This results in smoother animations, |
| 616 | smoother scrolling, and overall better performance and response to user interaction.</p></li> |
| 617 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 618 | |
| 619 | <li><b>View support for hardware and software layers</b> |
| 620 | |
| 621 | <p>By default, a {@link android.view.View} has no layer specified. You can specify that the |
| 622 | view be backed by either a hardware or software layer, specified by values {@link |
| 623 | android.view.View#LAYER_TYPE_HARDWARE} and {@link android.view.View#LAYER_TYPE_SOFTWARE}, using |
| 624 | {@link android.view.View#setLayerType setLayerType()} or the <a |
| 625 | href="{@docRoot}reference/android/view/View.html#attr_android:layerType">{@code layerType}</a> |
| 626 | attribute.</p> |
| 627 | <p>A hardware layer is backed by a hardware specific texture (generally Frame Buffer Objects or |
| 628 | FBO on OpenGL hardware) and causes the view to be rendered using Android's hardware rendering |
| 629 | pipeline, but only if hardware acceleration is turned on for the view hierarchy. When hardware |
| 630 | acceleration is turned off, hardware layers behave exactly as software layers.</p> |
| 631 | <p>A software layer is backed by a bitmap and causes the view to be rendered using Android's |
| 632 | software rendering pipeline, even if hardware acceleration is enabled. Software layers should be |
| 633 | avoided when the affected view tree updates often. Every update will require to re-render the |
| 634 | software layer, which can potentially be slow.</p> |
| 635 | <p>For more information, see the {@link android.view.View#LAYER_TYPE_HARDWARE} and {@link |
| 636 | android.view.View#LAYER_TYPE_SOFTWARE} documentation.</p> |
| 637 | </li> |
| 638 | |
| 639 | |
| 640 | <li><b>Renderscript 3D graphics engine</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 641 | |
| 642 | <p>Renderscript is a runtime 3D framework that provides both an API for building 3D scenes as well |
| 643 | as a special, platform-independent shader language for maximum performance. Using Renderscript, you |
| 644 | can accelerate graphics operations and data processing. Renderscript is an ideal way to create |
Scott Main | 64b12ea | 2011-02-14 13:41:03 -0800 | [diff] [blame] | 645 | high-performance 3D effects for applications, wallpapers, carousels, and more.</p> |
| 646 | <p>For more information, see the <a |
| 647 | href="{@docRoot}guide/topics/graphics/renderscript.html">3D Rendering and Computation with |
| 648 | Renderscript</a> documentation.</p></li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 649 | </ul> |
| 650 | |
| 651 | |
| 652 | |
| 653 | |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 654 | <h3>Media</h3> |
| 655 | |
| 656 | |
| 657 | <ul> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 658 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 659 | <li><b>Time lapse video</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 660 | |
| 661 | <p>Camcorder APIs now support the ability to record time lapse video. The {@link |
| 662 | android.media.MediaRecorder#setCaptureRate setCaptureRate()} sets the rate at which frames |
| 663 | should be captured.</p></li> |
| 664 | |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 665 | <li><b>Texture support for image streams</b> |
| 666 | |
| 667 | <p>New {@link android.graphics.SurfaceTexture} allows you to capture an image stream as an OpenGL ES |
| 668 | texture. By calling {@link android.hardware.Camera#setPreviewTexture setPreviewTexture()} for your |
| 669 | {@link android.hardware.Camera} instance, you can specify the {@link |
| 670 | android.graphics.SurfaceTexture} upon which to draw video playback or preview frames from the |
| 671 | camera.</p></li> |
| 672 | |
| 673 | <li><b>HTTP Live streaming</b> |
| 674 | |
| 675 | <p>Applications can now pass an M3U playlist URL to the media framework to begin an HTTP Live |
| 676 | streaming session. The media framework supports most of the HTTP Live streaming specification, |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 677 | including adaptive bit rate. See the <a |
| 678 | href="{@docRoot}guide/appendix/media-formats.html">Supported Media Formats</a> document for |
| 679 | more information.</p></li> |
Scott Main | 7afdaf0 | 2011-01-25 13:03:30 -0800 | [diff] [blame] | 680 | |
| 681 | <li><b>EXIF data</b> |
| 682 | |
| 683 | <p>The {@link android.media.ExifInterface} includes new fields for photo aperture, ISO, and exposure |
| 684 | time.</p></li> |
| 685 | |
| 686 | <li><b>Camcorder profiles</b> |
| 687 | |
| 688 | <p>New {@link android.media.CamcorderProfile#hasProfile hasProfile()} method and several video |
| 689 | quality profiles (such as {@link android.media.CamcorderProfile#QUALITY_1080P}, {@link |
| 690 | android.media.CamcorderProfile#QUALITY_720P}, {@link |
| 691 | android.media.CamcorderProfile#QUALITY_CIF}, and others) allow you to determine camcorder |
| 692 | quality options.</p></li> |
| 693 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 694 | <li><b>Digital media file transfer</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 695 | |
| 696 | <p>The platform includes built-in support for Media/Picture Transfer Protocol (MTP/PTP) over USB, |
| 697 | which lets users easily transfer any type of media files between devices and to a host computer. |
| 698 | Developers can build on this support, creating applications that let users create or manage rich |
| 699 | media files that they may want to transfer or share across devices. </p></li> |
| 700 | |
Scott Main | d41ff8e | 2011-01-21 14:51:33 -0800 | [diff] [blame] | 701 | <li><b>Digital rights management (DRM)</b> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 702 | |
| 703 | <p>New extensible digital rights management (DRM) framework for checking and enforcing digital |
| 704 | rights. It's implemented in two architectural layers:</p> |
| 705 | <ul> |
| 706 | <li>A DRM framework API, which is exposed to applications and runs through the Dalvik VM for |
| 707 | standard applications.</li> |
| 708 | <li>A native code DRM manager that implements the framework API and exposes an interface for DRM |
| 709 | plug-ins to handle rights management and decryption for various DRM schemes.</li> |
| 710 | </ul> |
| 711 | |
| 712 | <p>For application developers, the framework offers an abstract, unified API that simplifies the |
| 713 | management of protected content. The API hides the complexity of DRM operations and allows a |
| 714 | consistent operation mode for both protected and unprotected content, and across a variety of DRM |
| 715 | schemes.</p> |
| 716 | |
| 717 | <p>For device manufacturers, content owners, and Internet digital media providers the DRM |
| 718 | framework?s plugin API provides a means of adding support for a DRM scheme of choice into the |
| 719 | Android system, for secure enforcement of content protection.</p> |
| 720 | |
| 721 | <p>The preview release does not provide any native DRM plug-ins for checking and enforcing digital |
| 722 | rights. However, device manufacturers may ship DRM plug-ins with their devices.</p> |
| 723 | |
| 724 | <p>You can find all of the DRM APIs in the {@link android.drm} package.</p></li> |
| 725 | |
| 726 | </ul> |
| 727 | |
| 728 | |
| 729 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 730 | <h3>Keyboard support</h3> |
| 731 | |
| 732 | <ul> |
| 733 | <li>Support for Control, Meta, Caps Lock, Num Lock and Scroll Lock modifiers. For more information, |
| 734 | see {@link android.view.KeyEvent#META_CTRL_ON} and related fields.</li> |
| 735 | |
| 736 | <li>Support for full desktop-style keyboards, including support for keys such as Escape, Home, End, |
| 737 | Delete and others. You can determine whether key events are coming from a full keyboard by |
| 738 | querying {@link android.view.KeyCharacterMap#getKeyboardType()} and checking for {@link |
| 739 | android.view.KeyCharacterMap#FULL KeyCharacterMap.FULL}</li> |
| 740 | |
| 741 | <li>{@link android.widget.TextView} now supports keyboard-based cut, copy, paste, and select-all, |
| 742 | using the key combinations Ctrl+X, Ctrl+C, Ctrl+V, and Ctrl+A. It also supports PageUp/PageDown, |
| 743 | Home/End, and keyboard-based text selection.</li> |
| 744 | |
| 745 | <li>{@link android.view.KeyEvent} adds several new methods to make it easier to check the key |
| 746 | modifier state correctly and consistently. See {@link android.view.KeyEvent#hasModifiers(int)}, |
| 747 | {@link android.view.KeyEvent#hasNoModifiers()}, |
| 748 | {@link android.view.KeyEvent#metaStateHasModifiers(int,int) metaStateHasModifiers()}, |
| 749 | {@link android.view.KeyEvent#metaStateHasNoModifiers(int) metaStateHasNoModifiers()}.</li> |
| 750 | |
| 751 | <li>Applications can implement custom keyboard shortcuts by subclassing {@link |
| 752 | android.app.Activity}, {@link android.app.Dialog}, or {@link android.view.View} and implementing |
| 753 | {@link android.app.Activity#onKeyShortcut onKeyShortcut()}. The framework calls this method |
| 754 | whenever a key is combined with Ctrl key. When creating an <a |
| 755 | href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a>, you can register keyboard |
| 756 | shortcuts by setting either the {@code android:alphabeticShortcut} or {@code |
| 757 | android:numericShortcut} attribute for each <a |
| 758 | href="{@docRoot}guide/topics/resources/menu-resource.html#item-element">{@code <item>}</a> |
| 759 | element (or with {@link android.view.MenuItem#setShortcut setShortcut()}).</li> |
| 760 | |
| 761 | <li>Android 3.0 includes a new "virtual keyboard" device with the id {@link |
| 762 | android.view.KeyCharacterMap#VIRTUAL_KEYBOARD KeyCharacterMap.VIRTUAL_KEYBOARD}. The virtual |
| 763 | keyboard has a desktop-style US key map which is useful for synthesizing key events for testing |
| 764 | input.</li> |
| 765 | |
| 766 | </ul> |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | <h3>Split touch events</h3> |
| 772 | |
| 773 | <p>Previously, only a single view could accept touch events at one time. Android 3.0 |
| 774 | adds support for splitting touch events across views and even windows, so different views can accept |
| 775 | simultaneous touch events.</p> |
| 776 | |
| 777 | <p>Split touch events is enabled by default when an application targets |
| 778 | Android 3.0. That is, when the application has set either the <a |
| 779 | href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code android:minSdkVersion}</a> |
| 780 | or <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code |
| 781 | android:targetSdkVersion}</a> attribute's value to {@code "11"}.</p> |
| 782 | |
Scott Main | c2299de | 2011-02-14 11:37:50 -0800 | [diff] [blame] | 783 | <p>However, the following properties allow you to disable split touch events across views inside |
| 784 | specific view groups and across windows.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 785 | |
| 786 | <ul> |
| 787 | <li>The {@link android.R.attr#splitMotionEvents android:splitMotionEvents} attribute for view groups |
Scott Main | c2299de | 2011-02-14 11:37:50 -0800 | [diff] [blame] | 788 | allows you to disable split touch events that occur between child views in a layout. For example: |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 789 | <pre> |
| 790 | <LinearLayout android:splitMotionEvents="false" ... > |
| 791 | ... |
| 792 | </LinearLayout> |
| 793 | </pre> |
Scott Main | c2299de | 2011-02-14 11:37:50 -0800 | [diff] [blame] | 794 | <p>This way, child views in the linear layout cannot split touch events—only one view can |
| 795 | receive touch events at a time.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 796 | </li> |
| 797 | |
| 798 | <li>The {@link android.R.attr#windowEnableSplitTouch android:windowEnableSplitTouch} style property |
Scott Main | c2299de | 2011-02-14 11:37:50 -0800 | [diff] [blame] | 799 | allows you to disable split touch events across windows, by applying it to a theme for the activity |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 800 | or entire application. For example: |
| 801 | <pre> |
| 802 | <style name="NoSplitMotionEvents" parent="android:Theme.Holo"> |
| 803 | <item name="android:windowEnableSplitTouch">false</item> |
| 804 | ... |
| 805 | </style> |
| 806 | </pre> |
| 807 | <p>When this theme is applied to an <a |
| 808 | href="{@docRoot}guide/topics/manifest/activity-element.html">{@code <activity>}</a> or <a |
| 809 | href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>, |
| 810 | only touch events within the current activity window are accepted. For example, by disabling split |
| 811 | touch events across windows, the system bar cannot receive touch events at the same time as the |
Scott Main | c2299de | 2011-02-14 11:37:50 -0800 | [diff] [blame] | 812 | activity. This does <em>not</em> affect whether views inside the activity can split touch |
| 813 | events—by default, the activity can still split touch events across views.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 814 | |
| 815 | <p>For more information about creating a theme, read <a |
| 816 | href="{@docRoot}guide/topics/ui/themes.html">Applying Styles and Themes</a>.</p> |
| 817 | </li> |
| 818 | </ul> |
| 819 | |
| 820 | |
| 821 | |
| 822 | <h3>WebKit</h3> |
| 823 | |
| 824 | <ul> |
| 825 | <li>New {@link android.webkit.WebViewFragment} class to create a fragment composed of a |
| 826 | {@link android.webkit.WebView}.</li> |
| 827 | <li>New {@link android.webkit.WebSettings} methods: |
| 828 | <ul> |
| 829 | <li>{@link |
| 830 | android.webkit.WebSettings#setDisplayZoomControls setDisplayZoomControls()} allows you to hide |
| 831 | the on-screen zoom controls while still allowing the user to zoom with finger gestures ({@link |
| 832 | android.webkit.WebSettings#setBuiltInZoomControls setBuiltInZoomControls()} must be set |
| 833 | {@code true}).</li> |
| 834 | <li>New {@link android.webkit.WebSettings} method, {@link |
| 835 | android.webkit.WebSettings#setEnableSmoothTransition setEnableSmoothTransition()}, allows you |
| 836 | to enable smooth transitions when panning and zooming. When enabled, WebView will choose a solution |
| 837 | to maximize the performance (for example, the WebView's content may not update during the |
| 838 | transition).</li> |
| 839 | </ul> |
| 840 | <li>New {@link android.webkit.WebView} methods: |
| 841 | <ul> |
| 842 | <li>{@link android.webkit.WebView#onPause onPause()} callback, to pause any processing |
| 843 | associated with the WebView when it becomes hidden. This is useful to reduce unnecessary CPU or |
| 844 | network traffic when the WebView is not in the foreground.</li> |
| 845 | <li>{@link android.webkit.WebView#onResume onResume()} callback, to resume processing |
| 846 | associated with the WebView, which was paused during {@link android.webkit.WebView#onPause |
| 847 | onPause()}.</li> |
| 848 | <li>{@link android.webkit.WebView#saveWebArchive saveWebArchive()} allows you to save the |
| 849 | current view as a web archive on the device.</li> |
| 850 | <li>{@link android.webkit.WebView#showFindDialog showFindDialog()} initiates a text search in |
| 851 | the current view.</li> |
| 852 | </ul> |
| 853 | </li> |
| 854 | </ul> |
| 855 | |
| 856 | |
| 857 | |
| 858 | <h3>Browser</h3> |
| 859 | |
| 860 | <p>The Browser application adds the following features to support web applications:</p> |
| 861 | |
| 862 | <ul> |
| 863 | <li><b>Media capture</b> |
| 864 | <p>As defined by the <a href="http://dev.w3.org/2009/dap/camera/">HTML Media Capture</a> |
| 865 | specification, the Browser allows web applications to access audio, image and video capture |
| 866 | capabilities of the device. For example, the following HTML provides an input for the user to |
| 867 | capture a photo to upload:</p> |
| 868 | <pre> |
| 869 | <input type="file" accept="image/*;capture=camera" /> |
| 870 | </pre> |
| 871 | <p>Or by excluding the {@code capture=camera} parameter, the user can choose to either capture a |
| 872 | new image with the camera or select one from the device (such as from the Gallery application).</p> |
| 873 | </li> |
| 874 | |
| 875 | <li><b>Device Orientation</b> |
| 876 | <p>As defined by the <a |
| 877 | href="http://dev.w3.org/geo/api/spec-source-orientation.html">Device Orientation Event</a> |
| 878 | specification, the Browser allows web applications to listen to DOM events that provide information |
| 879 | about the physical orientation and motion of the device.</p> |
| 880 | <p>The device orientation is expressed with the x, y, and z axes, in degrees and motion is |
| 881 | expressed with acceleration and rotation rate data. A web page can register for orientation |
| 882 | events by calling {@code window.addEventListener} with event type {@code "deviceorientation"} |
| 883 | and register for motion events by registering the {@code "devicemotion"} event type.</p> |
| 884 | </li> |
| 885 | |
| 886 | <li><b>CSS 3D Transforms</b> |
| 887 | <p>As defined by the <a href="http://www.w3.org/TR/css3-3d-transforms/">CSS 3D Transform |
| 888 | Module</a> specification, the Browser allows elements rendered by CSS to be transformed in three |
| 889 | dimensions.</p> |
| 890 | </li> |
| 891 | </ul> |
| 892 | |
| 893 | |
| 894 | |
| 895 | <h3>JSON utilities</h3> |
| 896 | |
| 897 | <p>New classes, {@link android.util.JsonReader} and {@link android.util.JsonWriter}, help you |
Scott Main | 2788e4f | 2011-02-23 10:54:31 -0800 | [diff] [blame] | 898 | read and write JSON streams. The new APIs complement the {@link org.json} classes, which manipulate |
| 899 | a document in memory.</p> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 900 | |
| 901 | <p>You can create an instance of {@link android.util.JsonReader} by calling |
| 902 | its constructor method and passing the {@link java.io.InputStreamReader} that feeds the JSON string. |
| 903 | Then begin reading an object by calling {@link android.util.JsonReader#beginObject()}, read a |
| 904 | key name with {@link android.util.JsonReader#nextName()}, read the value using methods |
| 905 | respective to the type, such as {@link android.util.JsonReader#nextString()} and {@link |
| 906 | android.util.JsonReader#nextInt()}, and continue doing so while {@link |
| 907 | android.util.JsonReader#hasNext()} is true.</p> |
| 908 | |
| 909 | <p>You can create an instance of {@link android.util.JsonWriter} by calling its constructor and |
| 910 | passing the appropriate {@link java.io.OutputStreamWriter}. Then write the JSON data in a manner |
| 911 | similar to the reader, using {@link android.util.JsonWriter#name name()} to add a property name |
| 912 | and an appropriate {@link android.util.JsonWriter#value value()} method to add the respective |
| 913 | value.</p> |
| 914 | |
| 915 | <p>These classes are strict by default. The {@link android.util.JsonReader#setLenient setLenient()} |
| 916 | method in each class configures them to be more liberal in what they accept. This lenient |
| 917 | parse mode is also compatible with the {@link org.json}'s default parser.</p> |
| 918 | |
| 919 | |
| 920 | |
| 921 | |
| 922 | <h3>New feature constants</h3> |
| 923 | |
| 924 | <p>The <a |
| 925 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 926 | manfest element should be used to inform external entities (such as Google Play) of the set of |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 927 | hardware and software features on which your application depends. In this release, Android adds the |
| 928 | following new constants that applications can declare with this element:</p> |
| 929 | |
| 930 | <ul> |
| 931 | <li>{@link android.content.pm.PackageManager#FEATURE_FAKETOUCH "android.hardware.faketouch"} |
| 932 | <p>When declared, this indicates that the application is compatible with a device that offers an |
| 933 | emulated touchscreen (or better). A device that offers an emulated touchscreen provides a user input |
| 934 | system that can emulate a subset of touchscreen |
| 935 | capabilities. An example of such an input system is a mouse or remote control that drives an |
| 936 | on-screen cursor. Such input systems support basic touch events like click down, click up, and drag. |
| 937 | However, more complicated input types (such as gestures, flings, etc.) may be more difficult or |
| 938 | impossible on faketouch devices (and multitouch gestures are definitely not possible).</p> |
| 939 | <p>If your application does <em>not</em> require complicated gestures and you do |
| 940 | <em>not</em> want your application filtered from devices with an emulated touchscreen, you |
| 941 | should declare {@link |
| 942 | android.content.pm.PackageManager#FEATURE_FAKETOUCH "android.hardware.faketouch"} with a <a |
| 943 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> |
| 944 | element. This way, your application will be available to the greatest number of device types, |
| 945 | including those that provide only an emulated touchscreen input.</p> |
| 946 | <p>All devices that include a touchscreen also support {@link |
| 947 | android.content.pm.PackageManager#FEATURE_FAKETOUCH "android.hardware.faketouch"}, because |
| 948 | touchscreen capabilities are a superset of faketouch capabilities. Thus, unless you actually require |
| 949 | a touchscreen, you should add a <a |
| 950 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> |
| 951 | element for faketouch.</p> |
| 952 | </li> |
| 953 | </ul> |
| 954 | |
| 955 | |
| 956 | |
| 957 | |
| 958 | <h3>New permissions</h3> |
| 959 | |
| 960 | <ul> |
| 961 | <li>{@link android.Manifest.permission#BIND_REMOTEVIEWS |
| 962 | "android.permission.BIND_REMOTEVIEWS"} |
| 963 | <p>This must be declared as a required permission in the <a |
| 964 | href="{@docRoot}guide/topics/manifest/service-element.html">{@code <service>}</a> manifest |
| 965 | element for an implementation of {@link android.widget.RemoteViewsService}. For example, when |
| 966 | creating an App Widget that uses {@link android.widget.RemoteViewsService} to populate a |
| 967 | collection view, the manifest entry may look like this:</p> |
| 968 | <pre> |
| 969 | <service android:name=".widget.WidgetService" |
| 970 | android:exported="false" |
| 971 | android:permission="android.permission.BIND_REMOTEVIEWS" /> |
| 972 | </pre> |
| 973 | </ul> |
| 974 | |
| 975 | |
| 976 | |
| 977 | <h3>New platform technologies</h3> |
| 978 | |
| 979 | <ul> |
| 980 | <li><strong>Storage</strong> |
| 981 | <ul> |
| 982 | <li>ext4 file system support to enable onboard eMMC storage.</li> |
| 983 | <li>FUSE file system to support MTP devices.</li> |
| 984 | <li>USB host mode support to support keyboards and USB hubs.</li> |
| 985 | <li>Support for MTP/PTP </li> |
| 986 | </ul> |
| 987 | </li> |
| 988 | |
| 989 | <li><strong>Linux Kernel</strong> |
| 990 | <ul> |
| 991 | <li>Upgraded to 2.6.36</li> |
| 992 | </ul> |
| 993 | </li> |
| 994 | |
| 995 | <li><strong>Dalvik VM</strong> |
| 996 | <ul> |
| 997 | <li>New code to support and optimize for SMP</li> |
| 998 | <li>Various improvements to the JIT infrastructure</li> |
| 999 | <li>Garbage collector improvements: |
| 1000 | <ul> |
| 1001 | <li>Tuned for SMP</li> |
| 1002 | <li>Support for larger heap sizes</li> |
| 1003 | <li>Unified handling for bitmaps and byte buffers</li> |
| 1004 | </ul> |
| 1005 | </li> |
| 1006 | </ul> |
| 1007 | </li> |
| 1008 | |
| 1009 | <li><strong>Dalvik Core Libraries</strong> |
| 1010 | <ul> |
| 1011 | <li>New, much faster implementation of NIO (modern I/O library)</li> |
| 1012 | <li>Improved exception messages</li> |
| 1013 | <li>Correctness and performance fixes throughout</li> |
| 1014 | </ul> |
| 1015 | </li> |
| 1016 | </ul> |
| 1017 | |
| 1018 | |
| 1019 | |
| 1020 | <h3 id="api-diff">API differences report</h3> |
| 1021 | |
| 1022 | <p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API Level |
| 1023 | {@sdkPlatformApiLevel}), see the <a |
| 1024 | href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API Differences Report</a>.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1025 | |
| 1026 | |
| 1027 | |
| 1028 | |
| 1029 | |
| 1030 | <h2 id="api-level">API Level</h2> |
| 1031 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1032 | <p>The Android {@sdkPlatformVersion} platform delivers an updated version of |
| 1033 | the framework API. The Android {@sdkPlatformVersion} API |
| 1034 | is assigned an integer identifier — |
| 1035 | <strong>{@sdkPlatformApiLevel}</strong> — that is |
| 1036 | stored in the system itself. This identifier, called the "API Level", allows the |
| 1037 | system to correctly determine whether an application is compatible with |
| 1038 | the system, prior to installing the application. </p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1039 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1040 | <p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, |
| 1041 | you need compile the application against the Android library that is provided in |
| 1042 | the Android {@sdkPlatformVersion} SDK platform. Depending on your needs, you might |
| 1043 | also need to add an <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> |
| 1044 | attribute to the <code><uses-sdk></code> element in the application's |
| 1045 | manifest. If your application is designed to run only on Android 2.3 and higher, |
| 1046 | declaring the attribute prevents the application from being installed on earlier |
| 1047 | versions of the platform.</p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1048 | |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1049 | <p>For more information about how to use API Level, see the <a |
| 1050 | href="{@docRoot}guide/appendix/api-levels.html">API Levels</a> document. </p> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1051 | |
| 1052 | |
| 1053 | <h2 id="apps">Built-in Applications</h2> |
| 1054 | |
| 1055 | <p>The system image included in the downloadable platform provides these |
| 1056 | built-in applications:</p> |
| 1057 | |
| 1058 | <table style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1059 | <tr> |
| 1060 | <td style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1061 | <ul> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1062 | <li>API Demos</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1063 | <li>Browser</li> |
| 1064 | <li>Calculator</li> |
| 1065 | <li>Camera</li> |
| 1066 | <li>Clock</li> |
| 1067 | <li>Contacts</li> |
| 1068 | <li>Custom Locale</li> |
| 1069 | <li>Dev Tools</li> |
| 1070 | <li>Downloads</li> |
| 1071 | <li>Email</li> |
| 1072 | </ul> |
| 1073 | </td> |
| 1074 | <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> |
| 1075 | <ul> |
| 1076 | <li>Gallery</li> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1077 | <li>Gestures Builder</li> |
| 1078 | <li>Messaging</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1079 | <li>Music</li> |
| 1080 | <li>Search</li> |
| 1081 | <li>Settings</li> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1082 | <li>Spare Parts</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1083 | <li>Speech Recorder</li> |
Scott Main | ea72329 | 2011-02-09 16:01:04 -0800 | [diff] [blame] | 1084 | <li>Widget Preview</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1085 | </ul> |
| 1086 | </td> |
| 1087 | </tr> |
| 1088 | </table> |
| 1089 | |
| 1090 | |
| 1091 | <h2 id="locs" style="margin-top:.75em;">Locales</h2> |
| 1092 | |
| 1093 | <p>The system image included in the downloadable SDK platform provides a variety of |
| 1094 | built-in locales. In some cases, region-specific strings are available for the |
| 1095 | locales. In other cases, a default version of the language is used. The |
| 1096 | languages that are available in the Android 3.0 system |
| 1097 | image are listed below (with <em>language</em>_<em>country/region</em> locale |
| 1098 | descriptor).</p> |
| 1099 | |
| 1100 | <table style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1101 | <tr> |
| 1102 | <td style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1103 | <ul> |
| 1104 | <li>Arabic, Egypt (ar_EG)</li> |
| 1105 | <li>Arabic, Israel (ar_IL)</li> |
| 1106 | <li>Bulgarian, Bulgaria (bg_BG)</li> |
| 1107 | <li>Catalan, Spain (ca_ES)</li> |
| 1108 | <li>Czech, Czech Republic (cs_CZ)</li> |
| 1109 | <li>Danish, Denmark(da_DK)</li> |
| 1110 | <li>German, Austria (de_AT)</li> |
| 1111 | <li>German, Switzerland (de_CH)</li> |
| 1112 | <li>German, Germany (de_DE)</li> |
| 1113 | <li>German, Liechtenstein (de_LI)</li> |
| 1114 | <li>Greek, Greece (el_GR)</li> |
| 1115 | <li>English, Australia (en_AU)</li> |
| 1116 | <li>English, Canada (en_CA)</li> |
| 1117 | <li>English, Britain (en_GB)</li> |
| 1118 | <li>English, Ireland (en_IE)</li> |
| 1119 | <li>English, India (en_IN)</li> |
| 1120 | <li>English, New Zealand (en_NZ)</li> |
| 1121 | <li>English, Singapore(en_SG)</li> |
| 1122 | <li>English, US (en_US)</li> |
Scott Main | b16965c | 2012-01-30 23:33:01 -0800 | [diff] [blame] | 1123 | <li>English, South Africa (en_ZA)</li> |
Scott Main | 7fb538c | 2011-01-19 21:11:50 -0800 | [diff] [blame] | 1124 | <li>Spanish (es_ES)</li> |
| 1125 | <li>Spanish, US (es_US)</li> |
| 1126 | <li>Finnish, Finland (fi_FI)</li> |
| 1127 | <li>French, Belgium (fr_BE)</li> |
| 1128 | <li>French, Canada (fr_CA)</li> |
| 1129 | <li>French, Switzerland (fr_CH)</li> |
| 1130 | <li>French, France (fr_FR)</li> |
| 1131 | <li>Hebrew, Israel (he_IL)</li> |
| 1132 | <li>Hindi, India (hi_IN)</li> |
| 1133 | </ul> |
| 1134 | </td> |
| 1135 | <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> |
| 1136 | <li>Croatian, Croatia (hr_HR)</li> |
| 1137 | <li>Hungarian, Hungary (hu_HU)</li> |
| 1138 | <li>Indonesian, Indonesia (id_ID)</li> |
| 1139 | <li>Italian, Switzerland (it_CH)</li> |
| 1140 | <li>Italian, Italy (it_IT)</li> |
| 1141 | <li>Japanese (ja_JP)</li> |
| 1142 | <li>Korean (ko_KR)</li> |
| 1143 | <li>Lithuanian, Lithuania (lt_LT)</li> |
| 1144 | <li>Latvian, Latvia (lv_LV)</li> |
| 1145 | <li>Norwegian bokmål, Norway (nb_NO)</li> |
| 1146 | <li>Dutch, Belgium (nl_BE)</li> |
| 1147 | <li>Dutch, Netherlands (nl_NL)</li> |
| 1148 | <li>Polish (pl_PL)</li> |
| 1149 | <li>Portuguese, Brazil (pt_BR)</li> |
| 1150 | <li>Portuguese, Portugal (pt_PT)</li> |
| 1151 | <li>Romanian, Romania (ro_RO)</li> |
| 1152 | <li>Russian (ru_RU)</li></li> |
| 1153 | <li>Slovak, Slovakia (sk_SK)</li> |
| 1154 | <li>Slovenian, Slovenia (sl_SI)</li> |
| 1155 | <li>Serbian (sr_RS)</li> |
| 1156 | <li>Swedish, Sweden (sv_SE)</li> |
| 1157 | <li>Thai, Thailand (th_TH)</li> |
| 1158 | <li>Tagalog, Philippines (tl_PH)</li> |
| 1159 | <li>Turkish, Turkey (tr_TR)</li> |
| 1160 | <li>Ukrainian, Ukraine (uk_UA)</li> |
| 1161 | <li>Vietnamese, Vietnam (vi_VN)</li> |
| 1162 | <li>Chinese, PRC (zh_CN)</li> |
| 1163 | <li>Chinese, Taiwan (zh_TW)</li> |
| 1164 | </td> |
| 1165 | </tr> |
| 1166 | </table> |
| 1167 | |
| 1168 | <p class="note"><strong>Note:</strong> The Android platform may support more |
| 1169 | locales than are included in the SDK system image. All of the supported locales |
| 1170 | are available in the <a href="http://source.android.com/">Android Open Source |
| 1171 | Project</a>.</p> |
| 1172 | |
| 1173 | <h2 id="skins">Emulator Skins</h2> |
| 1174 | |
| 1175 | <p>The downloadable platform includes the following emulator skin:</p> |
| 1176 | |
| 1177 | <ul> |
| 1178 | <li> |
| 1179 | WXGA (1280x800, medium density, xlarge screen) |
| 1180 | </li> |
| 1181 | </ul> |
| 1182 | |
| 1183 | <p>For more information about how to develop an application that displays |
| 1184 | and functions properly on all Android-powered devices, see <a |
| 1185 | href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple |
| 1186 | Screens</a>.</p> |