Android code , Android Phone, Android Developers

Android code , Android Phone, Android Developers and New Google Android Technologies

Run the API Demos Sample Application

Posted by admin May - 31 - 2010 - Monday ADD COMMENTS

Using Eclipse, load the API Demos application as a New Android Project. To do this, select File | New | Project from the Eclipse menu bar; a New Android Project wizard opens. Do not worry about the options in this wizard for now. Simply select Create Project From Existing Source and browse to the folder with the API Demo application in it. When the project is loaded, choose Run to see it execute in the Android Emulator. Navigate your way through the more than 40 different applications. Use each application to become familiar with the terminology and function of each API tool it demonstrates.

The Hello, Activity! application, shown in the following illustration, is a simple Hello World!–style application. Though simple in its design, Hello, Activity! does a good job of showing off the abilities of the platform. You will create your own Hello World!–style applications soon.

Lunar Lander
Lunar Lander, shown next, is a small game that plays on the Android Emulator. Lunar Lander shows how a simple 2-D game works on Android. The controls are fairly simple, and the game is not very complex. However, given these drawbacks, it is a great starter for game development.

Lunar Lander implements a simple control scheme (Up, Down, Left, and Right). The game also displays relatively fluid graphics and looks impressive given the platform. Complex game theories such as collision detection are used in a simple way. Although this book does not cover programming games for the Android platform, if you are interested in doing so, you may want to look at Lunar Lander for some tips.

Note Pad
Note Pad, as shown in the illustration that follows, allows you to open, create, and edit small notes. Note Pad is not a full-featured word editor, so do not expect it to be something to rival Word for Windows Mobile. However, it does a good job as a demonstration tool to show what is possible with a relatively small amount of code.

Skeleton App
Skeleton App, shown next, is an application shell. This is more of a base application that demonstrates a couple of different application features, such as fonts, buttons, images, and forms. If you are going to run Skeleton App by itself, you really are not going to get much out of it. You will be better served by referring to Skeleton App as a resource for how to implement specific items.

Snake
The final demo that is included with the Android SDK is Snake. This is a small, SNAFU-style game that is far more simplistic than Lunar Lander. This illustration shows what Snake looks like when run.

If you navigate to the base folder of each of the sample applications, you will see a folder named src. This is the source code folder for the given sample application. You can use this to view, edit, and recompile the code for any of the applications. Take advantage of this source code to learn some tricks and tips about the Android platform.

Downloading and Installing the Android Plugin for Eclipse

Posted by admin April - 17 - 2010 - Saturday ADD COMMENTS

The first step in setting up the Android SDK within the Eclipse development environment is to download and install the Android plugin for Eclipse. Both tasks of downloading and installing the plugin can be performed at the same time, and are relatively easy to do:

1. Open the Eclipse application. You will download the Android plugin for Eclipse from within the Eclipse IDE.

2. Choose Help | Software Updates | Find and Install.


3. In the Install/Update window, which allows you to begin the process of downloading and installing any of the plugins that are available to you for Eclipse, click the Search for New Features to Install radio button and then click  Next.


4. The Update Sites to Visit page of the Install window, shown next, lists all the default websites used for obtaining Eclipse plugins. However, the plugin you want, Android for Eclipse, is not available from the default sites. To download the Android plugin, you must tell Eclipse where to look for it, so click the New Remote Site button.

5. In the New Update Site dialog box, shown next, you must enter two pieces of 5.information to continue: a name for your new site, and its associated URL. The name is only for display purposes and does not affect the downloading of the plugin. In the Name field, enter Android Plugin. In the URL field, enter the URL from which Eclipse will obtain information about the plugins that are available:
https://dl-ssl.google.com/android/eclipse/ . Click OK.


NOTE
The name for your site can be anything you want, as long as it will help you identify what the link is. Feel free to use something other than Android Plugin.

6.A new site named Android Plugin should now be in your list of available sites:

At this point Eclipse has not yet looked for the plugin; this is just a list of paths that you can tell Eclipse to check when looking for new plugins to install.

7. Check the check box next to Android Plugin and then click Finish. Eclipse searches the URL associated with the Android Plugin site for any available plugins.

8. On the Search Results page of the Updates window, select the Android Plugin and then click Finish.

9. On the Feature License page of the Install window, shown next, accept the licensing agreement for the Android Development Tools and click Next.


NOTE
Keep in mind that all Eclipse plugins are installed to the %installpath%/eclipse/plugins directory. This information will help you if you need to locate the files that make up the Android plugin.
10. Eclipse downloads the Android plugin. At the time of this writing, the plugin version is 10. 0.4.0.200802081635. On the final plugin installation page, Feature Verification, click Install All to complete the installation of the Android plugin.

With the Android plugin installed, the last step you have to perform is to configure the plugin.