page.title=Android 3.0 Platform Preview @jd:body

In this document

  1. API Overview
  2. API Level
  3. Built-in Applications
  4. Locales
  5. Emulator Skins

Reference

  1. API Differences Report »

See Also

  1. Getting Started

API Level: Honeycomb

For developers, the Android 3.0 preview is available as a downloadable component for the Android SDK.

Note: Read the Getting Started guide for important information about setting up your development environment and limitiations of the Android 3.0 preview.

API Overview

The sections below provide a technical overview of what's new for developers in Android 3.0, including new features and changes in the framework API since the previous version.

Fragments

A fragment is a new framework component that allows you to separate distinct elements of an activity into self-contained modules that define their own UI and lifecycle. To create a fragment, you must extend the {@link android.app.Fragment} class and implement several lifecycle callback methods, similar to an {@link android.app.Activity}. You can then combine multiple fragments in a single activity to build a multi-pane UI in which each pane manages its own lifecycle and user inputs.

You can also use a fragment without providing a UI and instead use the fragment as a worker for the activity, such as to manage the progress of a download that occurs only while the activity is running.

Additionally:

To manage the fragments in your activity, you must use the {@link android.app.FragmentManager}, which provides several APIs for interacting with fragments, such as finding fragments in the activity and popping fragments off the back stack to restore them after they've been removed or hidden.

To perform a transaction, such as add or remove a fragment, you must create a {@link android.app.FragmentTransaction}. You can then call methods such as {@link android.app.FragmentTransaction#add add()} {@link android.app.FragmentTransaction#remove remove()}, or {@link android.app.FragmentTransaction#replace replace()}. Once you've applied all the changes you want to perform for the transaction, you must call {@link android.app.FragmentTransaction#commit commit()} and the system applies the fragment transaction to the activity.

For more information about using fragments, read the Fragments developer guide.

Action Bar

The Action Bar is a replacement for the traditional title bar at the top of the activity window. It includes the application logo in the left corner and provides a new interface for items in the activity's Options Menu. Additionally, the Action Bar allows you to:

The Action Bar is standard for all applications that set either the {@code android:minSdkVersion} or {@code android:targetSdkVersion} to {@code "Honeycomb"}. (The "Honeycomb" API Level is provisional and effective only while using the preview SDK—you must change it to the official API Level when the final SDK becomes available—see Getting Started for more information.)

For more information about the Action Bar, read the Action Bar developer guide.

System clipboard

Applications can now copy and paste data (beyond mere text) to and from the system-wide clipboard. Clipped data can be plain text, a URI, or an intent.

By providing the system access to your data in a content provider, the user can copy complex content (such as an image or data structure) from your application and paste it into another application that supports that type of content.

To start using the clipboard, get the global {@link android.content.ClipboardManager} object by calling {@link android.content.Context#getSystemService getSystemService(CLIPBOARD_SERVICE)}.

To create an item to attach to the clipboard ("copy"), you need to create a new {@link android.content.ClipData} object, which holds one or more {@link android.content.ClipData.Item} objects, each describing a single entity. To create a {@link android.content.ClipData} object with just one {@link android.content.ClipData.Item}, you can use one of the helper methods, such as {@link android.content.ClipData#newPlainText newPlainText()}, {@link android.content.ClipData#newUri newUri()}, and {@link android.content.ClipData#newIntent newIntent()}, which each return a {@link android.content.ClipData} object pre-loaded with the appropriate {@link android.content.ClipData.Item}.

To add the {@link android.content.ClipData} to the clipboard, pass it to {@link android.content.ClipboardManager#setPrimaryClip setPrimaryClip()} for your instance of {@link android.content.ClipboardManager}.

You can then acquire ("paste") a file from the clipboard by calling {@link android.content.ClipboardManager#getPrimaryClip()} on the {@link android.content.ClipboardManager}. Handling the {@link android.content.ClipData} you receive can be more complicated and you need to be sure you can actually handle the data type.

For more information, see the {@link android.content.ClipData} class reference. You can also see an example implementation of copy and paste in the NotePad sample application.

Drag and drop

New APIs facilitate the ability for your application to implement drag and drop functionality in the UI.

To begin dragging content in your activity, call {@link android.view.View#startDrag startDrag()} on a {@link android.view.View}, providing a {@link android.content.ClipData} object that represents the information to drag, a {@link android.view.View.DragShadowBuilder} to facilitate the "shadow" that the user sees while dragging, and an {@link java.lang.Object} that can share information about the drag object with views that may receive the object.

To accept a drag object (receive the "drop") in a {@link android.view.View}, register the view with an {@link android.view.View.OnDragListener OnDragListener} by calling {@link android.view.View#setOnDragListener setOnDragListener()}. When a drag event occurs on the view, the system calls {@link android.view.View.OnDragListener#onDrag onDrag()} for the {@link android.view.View.OnDragListener OnDragListener}, which receives a {@link android.view.DragEvent} describing the type of event has occurred (such as "drag started", "drag ended", or "drop"). During a drag, the system repeatedly calls {@link android.view.View.OnDragListener#onDrag onDrag()} for the view underneath the drag, to deliver a stream of events. The receiving view can inquire the event type delivered to {@link android.view.View#onDragEvent onDragEvent()} by calling {@link android.view.DragEvent#getAction getAction()} on the {@link android.view.DragEvent}.

Although a drag event may carry a {@link android.content.ClipData} object, this is not related to the system clipboard. The data being dragged is passed as a {@link android.content.ClipData} object to {@link android.view.View#startDrag startDrag()} and the system sends it to the receiving {@link android.view.View} in the {@link android.view.DragEvent} sent to {@link android.view.View.OnDragListener#onDrag onDrag()}. A drag and drop operation should never put the dragged data in the global system clipboard.

App widgets

Android 3.0 supports several new widget classes for more interactive app widgets, including: {@link android.widget.GridView}, {@link android.widget.ListView}, {@link android.widget.StackView}, {@link android.widget.ViewFlipper}, and {@link android.widget.AdapterViewFlipper}.

You can also use the new {@link android.widget.RemoteViewsService} to populate collection views such as ({@link android.widget.GridView}, {@link android.widget.ListView}, and {@link android.widget.StackView}).

{@link android.appwidget.AppWidgetProviderInfo} also supports two new fields: {@link android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} and {@link android.appwidget.AppWidgetProviderInfo#previewImage}. The {@link android.appwidget.AppWidgetProviderInfo#autoAdvanceViewId} field lets you specify the view ID of the app widget subview, which is auto-advanced by the app widget’s host. The {@link android.appwidget.AppWidgetProviderInfo#previewImage} field specifies a preview of what the app widget looks like and is shown to the user from the widget picker. If this field is not supplied, the app widget's icon is used for the preview.

Android also provides a new widget preview tool ({@code WidgetPreview}), located in the SDK tools, to take a screenshot of your app widget, which you can use when specifying the {@link android.appwidget.AppWidgetProviderInfo#previewImage} field.

Status bar notifications

The {@link android.app.Notification} APIs have been extended to support more content-rich status bar notifications, plus a new {@link android.app.Notification.Builder} class allows you to easily control the notification properties.

New features include:

Content loaders

New framework APIs facilitate asynchronous loading of data using the {@link android.content.Loader} class. You can use it in combination with UI components such as views and fragments to dynamically load data from worker threads. The {@link android.content.CursorLoader} subclass is specially designed to help do so for data queried from a {@link android.content.ContentResolver}.

Bluetooth A2DP and headset APIs

Android now includes APIs for applications to verify the state of connected Bluetooth A2DP and headset profile devices. For example, applications can identify when a Bluetooth headset is connected for listening to music and notify the user as appropriate. Applications can also receive broadcasts for vendor specific AT commands and notify the user about the state of the connected device, such as when the connected device's battery is low.

You can initialize the respective {@link android.bluetooth.BluetoothProfile} by calling {@link android.bluetooth.BluetoothAdapter#getProfileProxy getProfileProxy()} with either the {@link android.bluetooth.BluetoothProfile#A2DP} or {@link android.bluetooth.BluetoothProfile#HEADSET} profile constant and a {@link android.bluetooth.BluetoothProfile.ServiceListener} to receive callbacks when the Bluetooth client is connected or disconnected.

Animation framework

An all new flexible animation framework allows you to animate arbitrary properties of any object (View, Drawable, Fragment, Object, or anything else). It allows you to define many aspects of an animation, such as:

You can define these animation aspects, and others, for an object's int, float, and hexadecimal color values, by default. To animate any other type of value, you tell the system how to calculate the values for that given type, by implementing the {@link android.animation.TypeEvaluator} interface.

There are two animators you can use to animate values of a property: {@link android.animation.ValueAnimator} and {@link android.animation.ObjectAnimator}. The {@link android.animation.ValueAnimator} computes the animation values, but is not aware of the specific object or property that is animated as a result. It simply performs the calculations, and you must listen for the updates and process the data with your own logic. The {@link android.animation.ObjectAnimator} is a subclass of {@link android.animation.ValueAnimator} and allows you to set the object and property to animate, and it handles all animation work. That is, you give the {@link android.animation.ObjectAnimator} the object to animate, the property of the object to change over time, and a set of values to apply to the property over time in order to animate it, then start the animation.

Additionally, the {@link android.animation.LayoutTransition} class enables automatic transition animations for changes you make to your activity layout. To enable transitions for part of the layout, create a {@link android.animation.LayoutTransition} object and set it on any {@link android.view.ViewGroup} by calling {@link android.view.ViewGroup#setLayoutTransition setLayoutTransition()}. This causes default animations to run whenever items are added to or removed from the group. To specify custom animations, call {@link android.animation.LayoutTransition#setAnimator setAnimator()} on the {@link android.animation.LayoutTransition} and provide a custom {@link android.animation.Animator}, such as a {@link android.animation.ValueAnimator} or {@link android.animation.ObjectAnimator} discussed above.

For more information, see the Animation developer guide.

Extended UI framework

Graphics

Media

API Level

The Android 3.0 platform delivers an updated version of the framework API. Because this is a preview of the Android 3.0 API, it uses a provisional API level of "Honeycomb", instead of an integer identifier, which will be provided when the final SDK is made available and all APIs are final.

To use APIs introduced in Android 3.0 in your application, you need compile the application against the Android library that is provided in the Android 3.0 preview SDK platform and you must declare this API Level in your manifest as android:minSdkVersion="Honeycomb", in the <uses-sdk> element in the application's manifest.

For more information about using this provisional API Level and setting up your environment to use the preview SDK, please see the Getting Started document.

Built-in Applications

The system image included in the downloadable platform provides these built-in applications:

  • Browser
  • Calculator
  • Camera
  • Clock
  • Contacts
  • Custom Locale
  • Dev Tools
  • Downloads
  • Email
  • Gallery
  • Music
  • Search
  • Settings
  • Spare Parts (developer app)
  • Speech Recorder

Locales

The system image included in the downloadable SDK platform provides a variety of built-in locales. In some cases, region-specific strings are available for the locales. In other cases, a default version of the language is used. The languages that are available in the Android 3.0 system image are listed below (with language_country/region locale descriptor).

  • Arabic, Egypt (ar_EG)
  • Arabic, Israel (ar_IL)
  • Bulgarian, Bulgaria (bg_BG)
  • Catalan, Spain (ca_ES)
  • Czech, Czech Republic (cs_CZ)
  • Danish, Denmark(da_DK)
  • German, Austria (de_AT)
  • German, Switzerland (de_CH)
  • German, Germany (de_DE)
  • German, Liechtenstein (de_LI)
  • Greek, Greece (el_GR)
  • English, Australia (en_AU)
  • English, Canada (en_CA)
  • English, Britain (en_GB)
  • English, Ireland (en_IE)
  • English, India (en_IN)
  • English, New Zealand (en_NZ)
  • English, Singapore(en_SG)
  • English, US (en_US)
  • English, Zimbabwe (en_ZA)
  • Spanish (es_ES)
  • Spanish, US (es_US)
  • Finnish, Finland (fi_FI)
  • French, Belgium (fr_BE)
  • French, Canada (fr_CA)
  • French, Switzerland (fr_CH)
  • French, France (fr_FR)
  • Hebrew, Israel (he_IL)
  • Hindi, India (hi_IN)
  • Croatian, Croatia (hr_HR)
  • Hungarian, Hungary (hu_HU)
  • Indonesian, Indonesia (id_ID)
  • Italian, Switzerland (it_CH)
  • Italian, Italy (it_IT)
  • Japanese (ja_JP)
  • Korean (ko_KR)
  • Lithuanian, Lithuania (lt_LT)
  • Latvian, Latvia (lv_LV)
  • Norwegian bokmål, Norway (nb_NO)
  • Dutch, Belgium (nl_BE)
  • Dutch, Netherlands (nl_NL)
  • Polish (pl_PL)
  • Portuguese, Brazil (pt_BR)
  • Portuguese, Portugal (pt_PT)
  • Romanian, Romania (ro_RO)
  • Russian (ru_RU)
  • Slovak, Slovakia (sk_SK)
  • Slovenian, Slovenia (sl_SI)
  • Serbian (sr_RS)
  • Swedish, Sweden (sv_SE)
  • Thai, Thailand (th_TH)
  • Tagalog, Philippines (tl_PH)
  • Turkish, Turkey (tr_TR)
  • Ukrainian, Ukraine (uk_UA)
  • Vietnamese, Vietnam (vi_VN)
  • Chinese, PRC (zh_CN)
  • Chinese, Taiwan (zh_TW)
  • Note: The Android platform may support more locales than are included in the SDK system image. All of the supported locales are available in the Android Open Source Project.

    Emulator Skins

    The downloadable platform includes the following emulator skin:

    For more information about how to develop an application that displays and functions properly on all Android-powered devices, see Supporting Multiple Screens.