| |
| <p>This section includes samples for:</p> |
| <ul> |
| <li><a href="#Activity">Activity</a></li> |
| <li><a href="#Fragment">Fragment</a></li> |
| <li><a href="#ActionBar">Action Bar</a></li> |
| <li><a href="#LoaderManager">LoaderManager</a></li> |
| <li><a href="#Alarm">Alarm</a></li> |
| <li><a href="#Notification">Notification</a></li> |
| <li><a href="#Search">Search</a></li> |
| <li><a href="#Misc">Misc</a></li> |
| </ul> |
| |
| |
| <h3 id="Activity">Activity</h3> |
| <dl> |
| <dt><a href="HelloWorld.html">Hello World</a></dt> |
| <dd>Demonstrates a basic screen activity. |
| <dl> |
| <dt>Code: |
| <dd> <a href="HelloWorld.html">HelloWorld.java</a> |
| <dt>Layout: |
| <dd> <a href="../../../../../../res/layout/hello_world.html"> |
| hello_world.xml</a> |
| </dl> |
| </dd> |
| <dt><a href="SaveRestoreState.html">Save & Restore State</a></dt> |
| <dd>Demonstrates how an activity should save state when it is paused.</dd> |
| |
| <dt><a href="PersistentState.html">Persistent State</a></dt> |
| <dd>Demonstrates how you can save and restore preferences, which are stored |
| even after the user closes the application. </dd> |
| |
| <dt><a href="ReceiveResult.html">Receive Result</a></dt> |
| <dd>Demonstrates how an activity screen can return a result to the |
| activity that opened it. </dd> |
| |
| <dt><a href="Forwarding.html">Forwarding</a></dt> |
| <dd>Demonstrates opening a new activity and removing the current activity |
| from the history stack, so that when the user later presses BACK they will |
| not see the intermediate activity.</dd> |
| |
| <dt><a href="RedirectEnter.html">Redirection</a></dt> |
| <dd>Demonstrates how to save data to preferences and use it to determine |
| which activity to open next.</dd> |
| |
| <dt><a href="TranslucentActivity.html">Translucent</a></dt> |
| <dd>Demonstrates how to make an activity with a transparent background. </dd> |
| |
| <dt><a href="TranslucentBlurActivity.html">TranslucentBlur</a></dt> |
| <dd>Demonstrates how to make an activity with a transparent background with |
| a special effect (blur). </dd> |
| |
| <dt><a href="DialogActivity.html">Dialog Activity</a></dt> |
| <dd>An Activity that sets its theme to android:style/Theme.Dialog so that |
| it looks like a Dialog.</dd> |
| |
| <dt><a href="CustomTitle.html">Custom Title</a></dt> |
| <dd>An Activity that places a custom UI in its title.</dd> |
| |
| <dt><a href="Animation.html">Animation</a></dt> |
| <dd>Demonstrates how to use custom animations when moving between activities. </dd> |
| |
| <dt><a href="ActivityRecreate.html">Activity Recreate</a></dt> |
| <dd>Demonstrates how an Activity can cause itself to be recreated.</dd> |
| |
| <dt><a href="ScreenOrientation.html">Screen Orientation</a></dt> |
| <dd>Demonstrates the different screen orientations an Activity can request.</dd> |
| |
| <dt><a href="SoftInputModes.html">Soft Input Modes</a></dt> |
| <dd>Demonstrates how different soft input modes set in an Activity's |
| window impacts how it adjusts to accommodate an IME.</dd> |
| |
| <dt><a href="IntentActivityFlags.html">Intent Activity Flags</a></dt> |
| <dd>Demonstrates various uses of Intent flags to modify an application |
| task's activity stack in common ways.</dd> |
| |
| <dt><a href="ReorderOnLaunch.html">Reorder on Launch</a></dt> |
| <dd>Demonstrates how the activities in a task can be reordered. UI flow |
| goes through the activities <a href="ReorderOnLaunch.html">ReorderOnLaunch</a>, |
| <a href="ReorderTwo.html">ReorderTwo</a>, <a href="ReorderThree.html">ReorderThree</a>, |
| and <a href="ReorderFour.html">ReorderFour</a>.</dd> |
| |
| <dt><a href="WallpaperActivity.html">Wallpaper Activity</a></dt> |
| <dd>An Activity that uses android:style/Theme.Wallpaper to be displayed |
| on top of the system wallpaper.</dd> |
| </dl> |
| |
| <h3 id="Fragment">Fragment</h3> |
| <dl> |
| <dt><a href="FragmentAlertDialog.html">Fragment Alert Dialog</a></dt> |
| <dd>Demonstrates how to use a DialogFragment to show and manage an |
| AlertDialog.</dd> |
| |
| <dt><a href="FragmentArguments.html">Fragment Arguments</a></dt> |
| <dd>Demonstrates how a fragment can be initialized with arguments, |
| supplying them either as an argument Bundle at runtime or XML attributes |
| in a <fragment> tag.</dd> |
| |
| <dt><a href="FragmentContextMenu.html">Fragment Context Menu</a></dt> |
| <dd>Demonstrates how to display and respond to a context menu that is |
| display from a fragment's view hierarchy.</dd> |
| |
| <dt><a href="FragmentDialog.html">Fragment Dialog</a></dt> |
| <dd>Demonstrates use of DialogFragment to show various types of dialogs.</dd> |
| |
| <dt><a href="FragmentDialogOrActivity.html">Fragment Dialog or Activity</a></dt> |
| <dd>Demonstrates how the same Fragment implementation can be used to provide the UI |
| for either an Activity or Dialog.</dd> |
| |
| <dt><a href="FragmentHideShow.html">Fragment Hide Show</a></dt> |
| <dd>Demonstrates hiding and showing fragments.</dd> |
| |
| <dt><a href="FragmentLayout.html">Fragment Layout</a></dt> |
| <dd>Demonstrates use of the <fragment> tag to embed a Fragment in |
| an Activity's content view layout, and making the layout change based on |
| configuration to achieve different UI flows.</dd> |
| |
| <dt><a href="FragmentListArray.html">Fragment List Array</a></dt> |
| <dd>Demonstrates use of ListFragment to show the contents of a simple ArrayAdapter.</dd> |
| |
| <dt><a href="FragmentListCursorLoader.html">Fragment List Cursor Loader</a></dt> |
| <dd>Demonstrates use of LoaderManager to perform a query for a Cursor that |
| populates a ListFragment.</dd> |
| |
| <dt><a href="FragmentMenu.html">Fragment Menu</a></dt> |
| <dd>Demonstrates populating custom menu items from a Fragment.</dd> |
| |
| <dt><a href="FragmentReceiveResult.html">Fragment Receive Result</a></dt> |
| <dd>Demonstrates starting a new Activity from a Fragment, and receiving |
| a result back from it.</dd> |
| |
| <dt><a href="FragmentRetainInstance.html">Fragment Retain Instance</a></dt> |
| <dd>Demonstrates a Fragment can be used to easily retain active state across |
| an Activity's configuration change.</dd> |
| |
| <dt><a href="FragmentStack.html">Fragment Stack</a></dt> |
| <dd>Demonstrates creating a stack of Fragment instances similar to the |
| traditional stack of activities.</dd> |
| |
| </dl> |
| |
| |
| <h3 id="ActionBar">Action Bar</h3> |
| <dl> |
| <dt><a href="ActionBarMechanics.html">Action Bar Mechanics</a></dt> |
| <dd>Demonstrates the basics of the Action Bar and how it interoperates with the standard options |
| menu. This demo is for informative purposes only; see Usage for an example of using the |
| Action Bar in a more idiomatic manner.</dd> |
| <dt><a href="ActionBarTabs.html">Action Bar Tabs</a></dt> |
| <dd>Demonstrates the use of Action Bar tabs and how they interact with other action bar |
| features.</dd> |
| <dt><a href="ActionBarUsage.html">Action Bar Usage</a></dt> |
| <dd>Demonstrates imple usage of the Action Bar, including a SearchView as an action item. The |
| default Honeycomb theme includes the Action Bar by default and a menu resource is used to populate |
| the menu data itself. If you'd like to see how these things work under the hood, see |
| Mechanics.</dd> |
| <dt><a href="ActionBarDisplayOptions.html">Display Options</a></dt> |
| <dd>Shows how various Action Bar display option flags can be combined and their effects.</dd> |
| </dl> |
| |
| |
| <h3 id="LoaderManager">LoaderManager</h3> |
| <dl> |
| <dt><a href="LoaderThrottle.html">Loader Throttle</a></dt> |
| <dd>Complete end-to-end demonstration of a simple content provider that |
| populates data in a list through a cursor loader. The UI allows the list |
| to be populated with a series of items, showing how AsyncTaskLoader's |
| throttling facility can be used to control how much a Loader is refreshed |
| in this case.</dd> |
| </dl> |
| |
| <h3 id="Service">Service</h3> |
| <dl> |
| <dt><a href="LocalService.html">Local Service</a></dt> |
| <dd>Demonstrate the implementation of a service that runs in the same |
| process as its client(s). Shows how those clients can either start/stop it |
| with Context.startService and Context.stopService, or bind and call it with |
| Context.bindService and Context.unindService. |
| This also shows how you can simplify working |
| with a service when you know it will only run in your own process. The client |
| code for interacting with the service is in |
| <a href="LocalServiceActivities.html">Local Service Activities</a>.</dd> |
| |
| <dt><a href="MessengerService.html">Messenger Service</a></dt> |
| <dd>Demonstrates binding to a Service whose interface is implemented with |
| the Messenger class. This is often an easier way to do remote communication |
| with a Service than using a raw AIDL interface. The client |
| code for interacting with the service is in |
| <a href="MessengerServiceActivities.html">Messenger Service Activities</a>.</dd> |
| |
| <dt><a href="RemoteService.html">Remote Service Controller and |
| Remove Service Binding</a></dt> |
| <dd>Demonstrates starting a service in a separate process, by assigning |
| <code>android:process=":remote"</code> to the service in the |
| AndroidManifest.xml file. Shows how those clients can either start/stop it |
| with Context.startService and Context.stopService, or bind and call it with |
| Context.bindService and Context.unindService. |
| Binding is similar to the local service sample, |
| but illustrates the additional work (defining aidl |
| interfaces) needed to interact with a service in another process. Also |
| shows how a service can publish multiple interfaces and implement |
| callbacks to its clients.</dd> |
| |
| <dt><a href="ServiceStartArguments.html">Service Start Arguments</a></dt> |
| <dd>Demonstrates how you can use a Service as a job queue, where you |
| submit jobs to it with Context.startService instead of binding to the service. Such a service |
| automatically stops itself once all jobs have been processed. This can be |
| a very convenient way to interact with a service when you do not need |
| a result back from it.</dd> |
| |
| <dt><a href="ForegroundService.html">Foreground Service</a></dt> |
| <dd>Shows how you |
| can write a Service that runs in the foreground and works on both pre-2.0 |
| and post-2.0 versions of the platform. This example will selectively use |
| the new foreground APIs that were introduced in Android 2.0 if they are |
| available.</dd> |
| |
| </dl> |
| |
| <h3 id="Alarm">Alarm</h3> |
| <dl> |
| <dt><a href="AlarmController.html">Alarm Controller</a></dt> |
| <dd>Demonstrates two ways you can schedule alarms: a one-shot alarm that |
| will happen once at a given time, and a repeating alarm that will happen |
| first at a given time and then continually trigger at regular intervals |
| after that. |
| <dl> |
| <dt>Code: |
| <dd> <a href="AlarmController.html">AlarmController.java</a> |
| <dd> <a href="OneShotAlarm.html">OneShotAlarm.java</a> |
| <dd> <a href="RepeatingAlarm.html">RepeatingAlarm.java</a> |
| <dt>Layout: |
| <dd> <a href="../../../../../../res/layout/alarm_controller.html"> |
| alarm_controller.xml</a> |
| </dl> |
| </dd> |
| |
| <dt><a href="AlarmService.html">Alarm Service</a></dt> |
| <dd>Demonstrates how you can schedule an alarm that causes a service to |
| be started. This is useful when you want to schedule alarms that initiate |
| long-running operations, such as retrieving recent e-mails. |
| <dl> |
| <dt>Code: |
| <dd> <a href="AlarmService.html">AlarmService.java</a> |
| <dd> <a href="AlarmService_Service.html">AlarmService_Service.java</a> |
| <dt>Layout: |
| <dd> <a href="../../../../../../res/layout/alarm_service.html"> |
| alarm_service.xml</a> |
| </dl> |
| </dd> |
| </dl> |
| |
| <h3 id="Notification">Notification</h3> |
| <dl> |
| <dt><a href="NotifyWithText.html">NotifyWithText</a></dt> |
| <dd>Demonstrates popup notifications of varying length.</dd> |
| |
| <dt><a href="IncomingMessage.html">IncomingMessage</a></dt> |
| <dd> Demonstrates sending persistent and transient notifications, with a View object in the notification. It also demonstrated inflating a View object from an XML layout resource. </dd> |
| |
| <dt><a href="StatusBarNotifications.html">Status Bar Notifications</a></dt> |
| <dd> Demonstrates a variety of different notifications that can be posted in |
| the status bar, and a standard way for handling them.</dd> |
| </dl> |
| |
| <h3 id="Search">Search</h3> |
| <dl> |
| <dt><a href="SearchInvoke.html">SearchInvoke</a></dt> |
| <dd>Demonstrates various ways in which activities can launch the Search UI.</dd> |
| |
| <dt><a href="SearchQueryResults.html">SearchQueryResults</a></dt> |
| <dd>Demonstrates an activity that receives Search intents and handles them.</dd> |
| |
| <dt><a href="SearchSuggestionSampleProvider.html">SearchSuggestionSampleProvider</a></dt> |
| <dd>Demonstrates how to configure and use the built-in "recent queries" suggestion provider.</dd> |
| </dl> |
| |
| |
| <h3 id="Misc">Misc</h3> |
| <dl> |
| <dt><a href="AlertDialogSamples.html">Alert Dialog Samples</a></dt> |
| <dd>Demonstrates various styles of alert dialogs.</dd> |
| |
| <dt><a href="DeviceAdminSample.html">Device Admin Sample</a></dt> |
| <dd>Demonstration of the implementation of a simple device administrator |
| and its use of the DevicePolicyManager.</dd> |
| </dl> |