How to Run API Demos on Android
API Demos is an Android project loaded with samples of code from various Android applications. These samples include notifications, alarms, menus, preferences and background services for different apps. Google bundles the samples into a single Android project so that the application code and other resource files for each sample are all in one place. Android includes links on its developer website for code on specific topics, such as animation, app widgets, content and graphics. The code selection is designed to show developers the key concepts and techniques of Android app development.
Instructions
-
-
1
Download Android's Software Development Kit (SDK) to your computer from Android's website. Launch SDK and open the Android Virtual Device, which allows you to model an Android device on your computer.
-
2
Select "Available Packages" in the SDK's left window, bringing up a list of components you can download from the SDK. Click on the appropriate samples -- API Demos is the samples directory -- verify your choices and click "Install" again. SDK will install the components of the samples on your virtual Android system.
-
-
3
Open Eclipse, Google's Android-environment emulator, and run the code for the selected samples. Once you understand the code, you can incorporate it into your own apps or modify it to something more useful to you. When you've incorporated the code into your work, run everything on the emulator again to confirm it performs properly.
-
1
Tips & Warnings
Android's website includes the written code for samples in the current Demos directory.
When you use sample code to develop your own application, choose which version of the Android platform you wish to compile the application for. Android lists APIs by level, with higher numbers indicating the most recent Android editions. Google recommends you compile your application using the lowest possible level of API compatible with your app.