English | Site Directory

Android - An Open Handset Alliance Project

API Demos

samples/ApiDemos/src/com/google/android/samples/app/

Activity

Hello World
Demonstrates a basic screen activity.
Save & Restore State
Demonstrates how an activity should save state when it is paused.
Persistent State
Demonstrates how you can save and restore preferences, which are stored even after the user closes the application.
Receive Result
Demonstrates how an activity screen can return a result to the activity that opened it.
Forwarding
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.
Redirection
Demonstrates how to save data to preferences and use it to determine which activity to open next.
Translucent
Demonstrates how to make an activity with a transparent background.
TranslucentFancy
Demonstrates how to make an activity with a transparent background and a special effect (blur).

Service

Local Service Controller
Starts and stops the service class LocalService that runs in the same process as the activity, to demonstrate a service's lifecycle when using Context.startService and Context.stopService.
Local Service Binding
Demonstrates binding to a service class LocalService that runs in the same process as the activity, to demonstrate using the Context.bindService and Context.unbindService methods with a service. This also shows how you can simplify working with a service when you know it will only run in your own process.
Remote Service Controller
Demonstrates starting a service in a separate process, by assigning android:process=":remote" to the service in the AndroidManifest.xml file.
Remote Service Binding
Demonstrates binding to a remote service, similar to the Local Service Binding sample, but illustrating 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.
Service Start Arguments Controller
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.
GTalk Data Message Sender
Demonstrates how you can use a GTalk service to send a data message to another user on the Android device.

Alarm

Alarm Controller
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.
Alarm Service
Demonstrates a very common background that puts together both alarms and service: a regularly scheduled alarm that results in the execution of a relatively long-lived service.

Notification

NotifyWithText
Demonstrates popup notifications of varying length.
IncomingMessage
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.
Notifying Service Controller
Demonstrates a service that updates a status bar notification at regular intervals.
Status Bar
Demonstrates adding various icons as notifications to the status bar.

Dialog

Alert Dialog Samples
Demonstrates different ways the AlertDialog can be used.

Search

Invoke Search
Demonstrates a few different ways to invoke search, and how to insert context-specific data for use by the search activity.
Query Search Results
Demonstrates how to set up an activity that accepts query strings via the SEARCH_ACTION intent.

Directory Contents

Files

Build m5-rc15g - 14 May 2008 12:50