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