The API Demos application includes a variety of small applications that illustrate the use of various Android APIs. It includes samples of:
You can find the source code for this sample in your SDK at:
<sdk>/platforms/android-<version>/samples/