Home | History | Annotate | Download | only in app
      1 
      2 <p>This section includes samples for:</p>
      3 <ul>
      4   <li><a href="#Activity">Activity</a></li>
      5   <li><a href="#Fragment">Fragment</a></li>
      6   <li><a href="#ActionBar">Action Bar</a></li>
      7   <li><a href="#LoaderManager">LoaderManager</a></li>
      8   <li><a href="#Alarm">Alarm</a></li>
      9   <li><a href="#Notification">Notification</a></li>
     10   <li><a href="#Search">Search</a></li>
     11   <li><a href="#Misc">Misc</a></li>
     12 </ul>
     13 
     14 
     15 <h3 id="Activity">Activity</h3>
     16 <dl>
     17   <dt><a href="HelloWorld.html">Hello World</a></dt>
     18   <dd>Demonstrates a basic screen activity.
     19   <dl>
     20   <dt>Code:
     21   <dd> <a href="HelloWorld.html">HelloWorld.java</a>
     22   <dt>Layout:
     23   <dd> <a href="../../../../../../res/layout/hello_world.html">
     24   hello_world.xml</a>
     25   </dl>
     26   </dd>
     27   <dt><a href="SaveRestoreState.html">Save &amp; Restore State</a></dt>
     28   <dd>Demonstrates how an activity should save state when it is paused.</dd>
     29 
     30   <dt><a href="PersistentState.html">Persistent State</a></dt>
     31   <dd>Demonstrates how you can save and restore preferences, which are stored
     32   even after the user closes the application. </dd>
     33 
     34   <dt><a href="ReceiveResult.html">Receive Result</a></dt>
     35   <dd>Demonstrates how an activity screen can return a result to the
     36   activity that opened it. </dd>
     37 
     38   <dt><a href="Forwarding.html">Forwarding</a></dt>
     39   <dd>Demonstrates opening a new activity and removing the current activity
     40   from the history stack, so that when the user later presses BACK they will
     41   not see the intermediate activity.</dd>
     42 
     43   <dt><a href="RedirectEnter.html">Redirection</a></dt>
     44   <dd>Demonstrates how to save data to preferences and use it to determine
     45   which activity to open next.</dd>
     46 
     47   <dt><a href="TranslucentActivity.html">Translucent</a></dt>
     48   <dd>Demonstrates how to make an activity with a transparent background. </dd>
     49 
     50   <dt><a href="TranslucentBlurActivity.html">TranslucentBlur</a></dt>
     51   <dd>Demonstrates how to make an activity with a transparent background with
     52   a special effect (blur). </dd>
     53 
     54   <dt><a href="DialogActivity.html">Dialog Activity</a></dt>
     55   <dd>An Activity that sets its theme to android:style/Theme.Dialog so that
     56   it looks like a Dialog.</dd>
     57 
     58   <dt><a href="CustomTitle.html">Custom Title</a></dt>
     59   <dd>An Activity that places a custom UI in its title.</dd>
     60 
     61   <dt><a href="Animation.html">Animation</a></dt>
     62   <dd>Demonstrates how to use custom animations when moving between activities. </dd>
     63 
     64   <dt><a href="ActivityRecreate.html">Activity Recreate</a></dt>
     65   <dd>Demonstrates how an Activity can cause itself to be recreated.</dd>
     66 
     67   <dt><a href="ScreenOrientation.html">Screen Orientation</a></dt>
     68   <dd>Demonstrates the different screen orientations an Activity can request.</dd>
     69 
     70   <dt><a href="SoftInputModes.html">Soft Input Modes</a></dt>
     71   <dd>Demonstrates how different soft input modes set in an Activity's
     72   window impacts how it adjusts to accommodate an IME.</dd>
     73 
     74   <dt><a href="IntentActivityFlags.html">Intent Activity Flags</a></dt>
     75   <dd>Demonstrates various uses of Intent flags to modify an application
     76   task's activity stack in common ways.</dd>
     77 
     78   <dt><a href="ReorderOnLaunch.html">Reorder on Launch</a></dt>
     79   <dd>Demonstrates how the activities in a task can be reordered.  UI flow
     80   goes through the activities <a href="ReorderOnLaunch.html">ReorderOnLaunch</a>,
     81   <a href="ReorderTwo.html">ReorderTwo</a>, <a href="ReorderThree.html">ReorderThree</a>,
     82   and <a href="ReorderFour.html">ReorderFour</a>.</dd>
     83 
     84   <dt><a href="WallpaperActivity.html">Wallpaper Activity</a></dt>
     85   <dd>An Activity that uses android:style/Theme.Wallpaper to be displayed
     86   on top of the system wallpaper.</dd>
     87 </dl>
     88 
     89 <h3 id="Fragment">Fragment</h3>
     90 <dl>
     91   <dt><a href="FragmentAlertDialog.html">Fragment Alert Dialog</a></dt>
     92   <dd>Demonstrates how to use a DialogFragment to show and manage an
     93   AlertDialog.</dd>
     94   
     95   <dt><a href="FragmentArguments.html">Fragment Arguments</a></dt>
     96   <dd>Demonstrates how a fragment can be initialized with arguments,
     97   supplying them either as an argument Bundle at runtime or XML attributes
     98   in a &lt;fragment> tag.</dd>
     99   
    100   <dt><a href="FragmentContextMenu.html">Fragment Context Menu</a></dt>
    101   <dd>Demonstrates how to display and respond to a context menu that is
    102   display from a fragment's view hierarchy.</dd>
    103   
    104   <dt><a href="FragmentCustomAnimation.html">Fragment Custom Animation</a></dt>
    105   <dd>Demonstrates the use of a custom animation for pushing and popping fragments
    106   on the back stack.</dd>
    107 
    108   <dt><a href="FragmentDialog.html">Fragment Dialog</a></dt>
    109   <dd>Demonstrates use of DialogFragment to show various types of dialogs.</dd>
    110   
    111   <dt><a href="FragmentDialogOrActivity.html">Fragment Dialog or Activity</a></dt>
    112   <dd>Demonstrates how the same Fragment implementation can be used to provide the UI
    113   for either an Activity or Dialog.</dd>
    114   
    115   <dt><a href="FragmentHideShow.html">Fragment Hide Show</a></dt>
    116   <dd>Demonstrates hiding and showing fragments.</dd>
    117   
    118   <dt><a href="FragmentLayout.html">Fragment Layout</a></dt>
    119   <dd>Demonstrates use of the &lt;fragment&gt; tag to embed a Fragment in
    120   an Activity's content view layout, and making the layout change based on
    121   configuration to achieve different UI flows.</dd>
    122   
    123   <dt><a href="FragmentListArray.html">Fragment List Array</a></dt>
    124   <dd>Demonstrates use of ListFragment to show the contents of a simple ArrayAdapter.</dd>
    125   
    126   <dt><a href="FragmentMenu.html">Fragment Menu</a></dt>
    127   <dd>Demonstrates populating custom menu items from a Fragment.</dd>
    128   
    129   <dt><a href="FragmentReceiveResult.html">Fragment Receive Result</a></dt>
    130   <dd>Demonstrates starting a new Activity from a Fragment, and receiving
    131   a result back from it.</dd>
    132   
    133   <dt><a href="FragmentRetainInstance.html">Fragment Retain Instance</a></dt>
    134   <dd>Demonstrates a Fragment can be used to easily retain active state across
    135   an Activity's configuration change.</dd>
    136   
    137   <dt><a href="FragmentStack.html">Fragment Stack</a></dt>
    138   <dd>Demonstrates creating a stack of Fragment instances similar to the
    139   traditional stack of activities.</dd>
    140   
    141   <dt><a href="FragmentTabs.html">Fragment Tabs</a></dt>
    142   <dd>Demonstrates implementing ActionBar tabs by switching between
    143   Fragments.</dd>
    144 
    145 </dl>
    146 
    147 
    148 <h3 id="ActionBar">Action Bar</h3>
    149 <dl>
    150   <dt><a href="ActionBarMechanics.html">Action Bar Mechanics</a></dt>
    151   <dd>Demonstrates the basics of the Action Bar and how it interoperates with the standard options
    152 menu. This demo is for informative purposes only; see Usage for an example of using the
    153 Action Bar in a more idiomatic manner.</dd>
    154   <dt><a href="ActionBarTabs.html">Action Bar Tabs</a></dt>
    155   <dd>Demonstrates the use of Action Bar tabs and how they interact with other action bar
    156 features.  Also see the <a href="FragmentTabs.html">Fragment Tabs</a> for a more
    157 complete example of how to switch between fragments.</dd>
    158   <dt><a href="ActionBarUsage.html">Action Bar Usage</a></dt>
    159   <dd>Demonstrates simple usage of the Action Bar, including a SearchView as an action item. The
    160 default Honeycomb theme includes the Action Bar by default and a menu resource is used to populate
    161 the menu data itself. If you'd like to see how these things work under the hood, see
    162 Mechanics.</dd>
    163   <dt><a href="ActionBarActionProviderSettingsActivity.html">Settings Action Provider</a></dt>
    164   <dd>Shows how to implement an ActionProvider for launching the system settings that supplies a
    165   menu item with a specialized action view and handles standard menu item clicks in one place.</dd>
    166   <dt><a href="ActionBarShareActionProviderActivity.html">Share Action Provider</a></dt>
    167   <dd>Shows how to use a ShareActionProvider to embed sharing functionality in your application
    168   via the streamlined sharing UI added in ICS. </dd>
    169   <dt><a href="ActionBarDisplayOptions.html">Display Options</a></dt>
    170   <dd>Shows how various Action Bar display option flags can be combined and their effects.</dd>
    171 </dl>
    172 
    173 
    174 <h3 id="LoaderManager">LoaderManager</h3>
    175 <dl>
    176   <dt><a href="LoaderCursor.html">Loader Cursor</a></dt>
    177   <dd>Demonstrates use of LoaderManager to perform a query for a Cursor that
    178   populates a ListFragment.</dd>
    179 
    180   <dt><a href="LoaderCustom.html">Loader Custom</a></dt>
    181   <dd>Demonstrates implementation and use of a custom Loader class.  The
    182   custom class here "loads" the currently installed applications.</dd>
    183 
    184   <dt><a href="LoaderThrottle.html">Loader Throttle</a></dt>
    185   <dd>Complete end-to-end demonstration of a simple content provider that
    186   populates data in a list through a cursor loader.  The UI allows the list
    187   to be populated with a series of items, showing how AsyncTaskLoader's
    188   throttling facility can be used to control how much a Loader is refreshed
    189   in this case.</dd>
    190 </dl>
    191   
    192 <h3 id="Service">Service</h3>
    193 <dl>
    194   <dt><a href="LocalService.html">Local Service</a></dt>
    195   <dd>Demonstrate the implementation of a service that runs in the same
    196   process as its client(s).  Shows how those clients can either start/stop it
    197   with Context.startService and Context.stopService, or bind and call it with
    198   Context.bindService and Context.unindService.
    199   This also shows how you can simplify working
    200   with a service when you know it will only run in your own process.  The client
    201   code for interacting with the service is in
    202   <a href="LocalServiceActivities.html">Local Service Activities</a>.</dd>
    203   
    204   <dt><a href="MessengerService.html">Messenger Service</a></dt>
    205   <dd>Demonstrates binding to a Service whose interface is implemented with
    206   the Messenger class.  This is often an easier way to do remote communication
    207   with a Service than using a raw AIDL interface.  The client
    208   code for interacting with the service is in
    209   <a href="MessengerServiceActivities.html">Messenger Service Activities</a>.</dd>
    210   
    211   <dt><a href="RemoteService.html">Remote Service Controller and
    212         Remove Service Binding</a></dt>
    213   <dd>Demonstrates starting a service in a separate process, by assigning
    214   <code>android:process=&quot;:remote&quot;</code> to the service in the
    215   AndroidManifest.xml file.  Shows how those clients can either start/stop it
    216   with Context.startService and Context.stopService, or bind and call it with
    217   Context.bindService and Context.unindService.
    218   Binding is similar to the local service sample,
    219   but illustrates the additional work (defining aidl
    220   interfaces) needed to interact with a service in another process.  Also
    221   shows how a service can publish multiple interfaces and implement
    222   callbacks to its clients.</dd>
    223 
    224   <dt><a href="ServiceStartArguments.html">Service Start Arguments</a></dt>
    225   <dd>Demonstrates how you can use a Service as a job queue, where you 
    226   submit jobs to it with Context.startService instead of binding to the service.  Such a service
    227   automatically stops itself once all jobs have been processed.  This can be
    228   a very convenient way to interact with a service when you do not need
    229   a result back from it.</dd>
    230   
    231   <dt><a href="ForegroundService.html">Foreground Service</a></dt>
    232   <dd>Shows how you
    233   can write a Service that runs in the foreground and works on both pre-2.0
    234   and post-2.0 versions of the platform.  This example will selectively use
    235   the new foreground APIs that were introduced in Android 2.0 if they are
    236   available.</dd>
    237 
    238 </dl>
    239 
    240 <h3 id="Alarm">Alarm</h3>
    241 <dl>
    242   <dt><a href="AlarmController.html">Alarm Controller</a></dt>
    243   <dd>Demonstrates two ways you can schedule alarms: a one-shot alarm that
    244   will happen once at a given time, and a repeating alarm that will happen
    245   first at a given time and then continually trigger at regular intervals
    246   after that.
    247   <dl>
    248   <dt>Code:
    249   <dd> <a href="AlarmController.html">AlarmController.java</a>
    250   <dd> <a href="OneShotAlarm.html">OneShotAlarm.java</a>
    251   <dd> <a href="RepeatingAlarm.html">RepeatingAlarm.java</a>
    252   <dt>Layout:
    253   <dd> <a href="../../../../../../res/layout/alarm_controller.html">
    254   alarm_controller.xml</a>
    255   </dl>
    256   </dd>
    257 
    258   <dt><a href="AlarmService.html">Alarm Service</a></dt>
    259   <dd>Demonstrates how you can schedule an alarm that causes a service to
    260     be started.  This is useful when you want to schedule alarms that initiate
    261     long-running operations, such as retrieving recent e-mails.
    262   <dl>
    263   <dt>Code:
    264   <dd> <a href="AlarmService.html">AlarmService.java</a>
    265   <dd> <a href="AlarmService_Service.html">AlarmService_Service.java</a>
    266   <dt>Layout:
    267   <dd> <a href="../../../../../../res/layout/alarm_service.html">
    268   alarm_service.xml</a>
    269   </dl>
    270   </dd>
    271 </dl>
    272 
    273 <h3 id="Notification">Notification</h3>
    274 <dl>
    275   <dt><a href="NotifyWithText.html">NotifyWithText</a></dt>
    276   <dd>Demonstrates popup notifications of varying length.</dd>
    277 
    278   <dt><a href="IncomingMessage.html">IncomingMessage</a></dt>
    279   <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>
    280 
    281   <dt><a href="StatusBarNotifications.html">Status Bar Notifications</a></dt>
    282   <dd> Demonstrates a variety of different notifications that can be posted in
    283   the status bar, and a standard way for handling them.</dd>
    284 </dl>
    285 
    286 <h3 id="Search">Search</h3>
    287 <dl>
    288   <dt><a href="SearchInvoke.html">SearchInvoke</a></dt>
    289   <dd>Demonstrates various ways in which activities can launch the Search UI.</dd>
    290   
    291   <dt><a href="SearchQueryResults.html">SearchQueryResults</a></dt>
    292   <dd>Demonstrates an activity that receives Search intents and handles them.</dd>
    293   
    294   <dt><a href="SearchSuggestionSampleProvider.html">SearchSuggestionSampleProvider</a></dt>
    295   <dd>Demonstrates how to configure and use the built-in "recent queries" suggestion provider.</dd>  
    296 </dl>
    297 
    298 
    299 <h3 id="Misc">Misc</h3>
    300 <dl>
    301   <dt><a href="AlertDialogSamples.html">Alert Dialog Samples</a></dt>
    302   <dd>Demonstrates various styles of alert dialogs.</dd>
    303   
    304   <dt><a href="DeviceAdminSample.html">Device Admin Sample</a></dt>
    305   <dd>Demonstration of the implementation of a simple device administrator
    306   and its use of the DevicePolicyManager.</dd>
    307 </dl>
    308