RSS

Search Engine

Friday, October 29, 2010

How to Install the Android SDK on Windows XP

Update: PDF version

How to Install the Android SDK on Windows XP and Create an Application that Runs in the Android Emulator
This tutorial shows you how to download and install Android SDK to get you started developing Android applications.

1. Download and Install the Android SDK and Test the Emulator
2. Install Java
3. Install Eclipse
4. Install the ADT Plugin in Eclipse
5. Create Hello World Application

1. Download and Install the Android SDK and test the Emulator

1.

Create a folder called "android" in the drive C. Go to http://code.google.com/android/download.html. Click on the android_sdk_windows... link, download and save it to c:\android.

2.

Unzip downloaded file.

3.

Now, set your PATH environment variable by right click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path under System Variables. Add the full path to the tools/ directory to the path, in this case, it is: C:\android\android-sdk-windows-1.0_r1\tools. Then click OK , OK , OK.

4.

Click on Start > All Programms > Accessories > Command prompt and type emulator, then hit ENTER , in a couple seconds the emulator will appear, please wait when it's starting up.

5. Click on Browser button.

6. Click on the Menu button, then click on Go to ... Type in a website address you want to view and press ENTER, ex: http://androidcore.com

2. Install Java

1.

Goto http://developers.sun.com/downloads/

2.

Choose Java SE (JDK) 6 link.

3.

Click on the Download button

4.

Click on the Download button

5.

Select Platform, Language for your download, check into the box "I agree to ..." and then click on the button "Continue"

6.

Click on the file name (jdk-6u10-windows-i586-p.exe) to start to download the Java SDK

Save it to C:\android

7.

After it has finished downloading, you will have this file in your directory (C:\android). Double click on file that was downloaded to start install Java SDK.

Accept agreement. And click Next to start install.

3. Install Eclipse

Eclipse is a professional editor.

1.

Go to http://www.eclipse.org/downloads/ . Download and save it to drive C:\. The current version of Eclipse is 3.4.1

2.

After it has finished downloading, you will have this file in your directory (C:\). Unzip this file.

3.

Double-click on the file c:\eclipse\eclipse.exe to run Eclipse editor.

Click OK to Continue.

4. Install the ADT Plugin

The ADT (Android Development Tools) plugin includes a variety of powerful extensions that make creating, running, and debugging Android applications faster and easier.

1.

Start Eclipse.

If you are using a proxy, please go to Windows > Preferences > General > Network Connections, choose "Manual proxy configuration" and type your proxy address here. If you are using a direct internet connection, you do not need to do this step.

Click Help > Software Updates

2.

Choose "Available Software" tab, then click on the button "Add Site ..."

3.

Copy and paste this link into input box "Location": https://dl-ssl.google.com/android/eclipse/, click OK

4.

Back in the Available Software view, you should see the plugin. "Android Developer Tools", and "Android Editors" should both be checked. The Android Editors feature is optional, but recommended. Then click on the button "Install ..."

5.

Click on the button Next

6.

Check the "I accept the terms of the license agreements" and click Finish.

7.

Wait to Eclipse download the plugin

8.

Eclipse will ask to restart, click on the button Yes

9.

After restart, update your Eclipse preferences to point to the SDK directory:

1. Select Window > Preferences... to open the Preferences panel.


2. Select Android from the left panel. If you get a dialog says: "Could not find folder 'tool' inside SDK ...", just click on the button OK
3. For the SDK Location in the main panel, click Browse... and locate the SDK directory.
4. Click Apply, then OK.

5. Create Hello World Application


This will show you how to make the first simple Android application with Eclipse.

1. Click File > New > Other....

2. Click on Android Project and click Next.

3. Fill out the form and click Finish.

4. Change the code in HelloWorld.java to the following.

  

package com.androidcore.hello;



import android.app.Activity;

import android.os.Bundle;

import android.widget.TextView;



public class HellWorld extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

//setContentView(R.layout.main);

TextView tv = new TextView(this);

tv.setText("Hello, Android");

setContentView(tv);

}

}

5. Click on menu Run, choose Run Configurations.

6. Click on Android Application, fill in Name, Project. Click on the "Launch" choice, choose Activity.

Then click on button Run.

7. Once Android Emulator is booted up, your application will appear. When all is said and done, you should see something like this:

That's it — you're done!

10 T-Mobile G1 Tips and Tricks

Product manuals are lame. The last thing we ever want to do when we purchase a fresh new gadget is sit there reading through a manual. Instead, we love to dive right into the gadgetry and start playing with our new toys. So we went through the T-Mobile G1’s horribly boring 48 page user manual to find 10 useful tips that you’ll really want to know.

1. Dial by Voice
The G1 supports voice dialing, and you can easily call a friend by stating their name if you press and hold the Send key on the G1. Bonus Tip: If you want to add in another caller while you’re on the phone, press the Send key while in a call.

2. Use an mp3 as your Ringtone

We’re not big fans of people using mp3s as ringtones, since the music selection is often pretty awful. Nonetheless, we’ll tell you how with the G1. Open Music > Songs > and hold your finger on your song of choice. Next, select “Use as phone ringtone.”

Read on for more.


3. Access the Applications Menu from Anywhere

If you’re surfing the Web and want to quickly bring up your music player to switch songs, you can quickly do this by holding down the Home button on the G1. This will quickly bring up your Applications menu. If you want to go directly to the desktop, just press the Home button once.

4. Turn on Wi-Fi
Phones don’t just automatically have Wi-Fi capabilities turned on. To do this, press the Menu key while you’re on the home screen.

Next, click Settings > Wireless Controls and select Wi-Fi
Open Wi-Fi settings to force the G1 to search for available networks.

5. Place your phone in silent mode on the fly

You just walked into a movie theater a few minutes late, and you want to quickly put the phone in silent mode without browsing through menus to do so. Avoid this by toggling silent mode without opening the G1. Simply press and hold the End key to put the phone in silent mode.

6. Add songs to a playlist
When you’re playing co-pilot on a long road trip, the music selection is up to you. Make the song selection smoother by creating a playlist ahead of time. On the G1, open up Music > Songs, and then touch and hold any song that you want to add to a playlist. A menu will pop up, and you’ll want to select Add to playlist.

7. Install a microSD card

You can install a microSD card for adding more storage or using your phone as a portable hard drive (see tip 9), and here’s how. First open the keyboard. Next, look for a small memory card cover below the Send key on the G1. Take your microSD card and slide it forward with the gold teeth facing down.

8. Typing Tips

Insert special character: Press ALT + Spacebar
Delete entire line of text: Press ALT + Delete
Turn on all caps: Press Shift Twice
Move cursor to end or beginning of text: Press Alt while scrolling Trackball
Insert a Tab space: Press Alt + Q
Highlight text: Press Shift and roll Trackball

9. Use your phone as a portable hard drive

The G1 supports high capacity microSD cards, which means you can add up to 16GB of storage to it. That’s as good as carrying a portable hard drive around with you. To treat your G1 as a portable storage device, you need to turn on mass storage.

Plug your G1 into your computer using a USB cable. Navigate to the home screen and select Menu > Settings > SD card & phone storage. Next, select Use for USB storage. Now a folder will pop up on your computer, and you can drag and drop music, videos, or any file of your choice onto the phone.

10. Cut, Copy, and Paste Text
Copying, cutting, and pasting text from Web sites or documents is easy with the G1.
To Cut, press Menu and x.
To Copy, press Menu and c
To Paste, press Menu and v.

Tuesday, October 26, 2010

OpenSocial Gadgets

OpenSocial Gadgets are part of the Open Social initiative. OpenSocial Gadgets are web based UI components. A Gadget is defined via a XML file which contains a header with definitions of the Gadget and an embedded content payload. This payload is a combination of HTML and JavaScript which defines the gadgets look and behavior.

A very simple Gadget looks like this.

   

A Gadget has always the root tag . This root tag contains a and a section. The ModulePrefs contains information which OpenSocial features are required by the module and information about the author. The content section contains the actual HTML and JavaScript.

A Gadget is hosted in a server infrastructure to provide its data. A web page that hosts gadgets is called an OpenSocial.

Most websites which work as a OpenSocial Container uses the Apache Shinding reference implementation.

For example the iGoogle , LinkedIn, MySpace, orkut, XING can host OpenSocial Gadgets. The only exception is Facebook; they have their own standard.

For detailed information you can read the latest released Open Social Specification .

Open Gadgets Gadgets are specified in OpenSocial Gadgets API Specification .

Hello OpenSocial Gadget

The following Open Social Gadgets example is based on this tutorial Google Tutorial for OpenSocial Gadgets

The following requires that you have some webspace to put your OpenSocial Gadget. It is sufficient to be able to host static webpage as we will create a static XML file. Google offers free web hosting via http://sites.google.com/ .

Create in a text editor the following file "welcome_gadget.xml"




   




Save this file on your webserver. If you want you can use my example (http://www.vogella.de/opensocial/welcome_gadget.xml).

On your iGoogle page press "Add Stuff" and "Add Feed or Gadget". You should now find it in your iGoogle page.

OpenSocial Development Environment for Eclipse

For developing OpenSocial Gadgets in Eclipse you can use the OpenSocial Development Environment which is described here OpenSocial Development Environment Homepage

OpenSocial Gadgets in Eclipse E4

Eclipse E4 allow to integrate OpenSocial Gadgets into views. To use this feature download the latest milestone from Eclipse E4 as described in Eclipse E4 tutorial .

Start Eclipse E4. To open a social gadget in E4 use Ctrl+3 type "Open Gadget" and input for example "http://www.google.com/ig/modules/eyes.xml".

Tip

Eclipse E4 allows to host the XML file also locally. Just use the file:// URL, e.g. /c:/temp/gadgets/gift_part3.xml to open the Gadget in Eclipse.

Tip

You can find the url to a OpenSocial Gadgets via your iGoogle page. Select your Gadget, select "Share this gadget" from the gadget menu, then click "copy and paste a link to this gadget" and copy the URL after "moduleurl".

The result looks like the following.

Thank you

Thank you for practicing with this tutorial.

I maintain this tutorial in my private time.

Saturday, October 23, 2010

Eclipse 4.0 SDK and Eclipse e4

1.1. Overview

Eclipse e4 project introduces a new set of technologies into the Eclipse platform that make Eclipse plugins and Eclipse RCP applications easier to write, more configurable and easier to reuse. The first release of the Eclipse e4 project is Eclipse 4.0 SDK. This article is based on the Eclipse 4.0 SDK.

The major enhancements in Eclipse e4 compared to Eclipse 3.x are:

  • The Eclipse workbench UI is described by an EMF model

  • The model is available at design- and runtime

  • Eclipse widgets can be styled via CSS style sheets

  • The existing Eclipse API's are re-worked to make them simpler

  • Eclipse e4 supports dependency injection for services into model components

  • The model elements are decoupled from their presentation via a Renderer Framework

1.2. About this tutorial

The following description will start with the creation of a e4 based application via a wizard to allow people to get quickly started. It describes the modeled workbench concept and the new programming model which is based on annotations and dependency injection. It then covers the declarative styling introduced in e4.

The remainder of the tutorial will be used to develop a e4 based todo application.

Installation

The Eclipse 4.0 SDK comes as a complete all-in-one download version, you find the latest version in http://download.eclipse.org/e4/sdk/ .

This download does not include all tooling which makes working with Eclipse e4 easier. Please use the update site "http://download.eclipse.org/e4/updates/2010" to install the following via the Eclipse update manager .

The tools provides wizards to create e4 artifacts and the specialized model editor for the e4 application model. The CSS tools "Eclipse e4 CSS Support" and "Eclipse E4 UI CSS Source"are required because the extension point "org.eclipse.e4.ui.css.swt.theme" requires the source bundle. The same applies for the "Eclipse e4 Model Workbench" and "Eclipse e4 Model Workbench Source" as the extension "org.eclipse.e4.workbench.model" requires the source feature. The reason for this is that the ".exsd" files for the extension points are part of the source features.

Your first e4 application

This chapter guides you through the first creation of an e4 based application via the available wizard .

3.1. Create project

Eclipse e4 provides a wizard for creating e4 applications. Select File -> New -> Others -> e4 -> "e4 Application Project". Create the project "de.vogella.e4.rcp.wizard" based on the following screenshots.

3.2. Launch

Open your product file "de.vogella.e4.rcp.wizard.product". Switch to the "Overview" tab and launch your product. This should start a small e4 application.

Steps for creating an e4 application

In the last chapter we used a wizard to create an Eclipse e4 application . This chapter provides a checklist of the necessary steps to create a new e4 application. All these steps will be later executed in detail.

To create a new basic e4 based application you:

  • Create a new plugin project

  • Maintain the dependencies to the necessary e4 plugins

  • Create an Application model description in a file which is typically called "Application.e4xmi"

  • You create a product configuration which uses the pre-defined application "org.eclipse.e4.ui.workbench.swt.E4Application".

  • In "plugin.xml" you point your application to the correct Application model description file, via the property "applicationXMI".

The concept of the modeled workbench

5.1. The model

The Eclipse e4 workbench is modeled via Eclipse EMF . This model contains the graphical elements of the workbench, e.g. the parts (views, editors, menu bars) and some non-visual parts of the command framework, e.g. handlers, commands and keybindings. This model of the workbench is available at runtime, e.g. the programmer can access the running model and change it during runtime.

Eclipse 3.x has a different concept of the workbench, in Eclipse 3.x the Ui elements are defined via extension points and stored in registries at runtime. These registries does not contain the actual relationship between the UI elements. In Eclipse 4.0 the workbench is explicitly modeled. It is also much more flexible compared to the Eclipse 3.x. For example you do not need to have perspectives and there is not an inherent distinction anymore between editors and views (both are called "Parts").

The e4 model consists roughly out of the following packages:

  • application: main elements, like IEclipeContext, Application and the following subpackages

  • ui - contains general components, e.g. the Context, menus, toolbars, parts and other UI related model components

  • commands - definition of commands, handlers and keybinding

  • descriptor - used to store information about the ui components

5.2. e4 WorkbenchModel Editor

In e4 the application is based on a EMF model . This model can be created and changed via the standard EMF tooling . The Eclipse e4 provides a specialized model editor (mainly developed by Tom Schindl ) which makes the easier to change an e4 application model. To open the model editor double-click on "Application.e4xmi" (or right click on it and select "Open-with"-> "e4 Workbenchmodel Editor".

5.3. Contributing to the e4 model

The base e4 application model is placed in an XMI file. This file is a standard XMI / text file. The application is at startup informed which file to use via the parameter "applicationXMI" of the extension point "org.eclipse.core.runtime.products". The XMI file is read at start time of the application and the initial application model is constructed from this file.

Model elements can also be supplied via the extension point "org.eclipse.e4.workbench.model". Model elements can be contributed via xmi (fragments) or via code (processors). These elements are merged into the application model. User changes are also recorded and saved independently.

The model information is read during startup and the contained information is to construct the workbench. The complete constructed model is available during runtime. Changes during runtime, e.g. the user moves a part, are written back to the model. If user changes should not be applied to the model you can specific the "-clearPersistedState" parameter as launch parameter. This would then be similar to the configurer.setSaveAndRestore(false) flag in Eclipse 3.x.

5.4. Merging model elements at startup

The e4 model has three potential parts which will be combined at runtime.

  1. The application defines in its "Application.e4xmi" file a base model (for example, main menu, perhaps UI elements like views that are always there, etc). This file changes over time as new versions of the application are being developed and released.

  2. Other plug-ins add to that model through our model extension point. Plug-ins can be installed and un-installed. This means that we have a model that results from combining the base model with these contributions. Of course, this means that there is an additional source of change to the model, but it is pretty clear how these contributions get merged into the model.

  3. While the application is running, the model objects can be changed. For example, views are closed, or menus/toolbars were customized, new views were opened, etc. These changes need to be persisted across sessions, and ideally even across updating plug-ins or the base application. The model delta are captured based on the difference to the real model, e.g. if you move View A to another place and move it back to the original position no delta is saved

The workbench model needs to the user changes and must be able to react to changes in the Application.e4xmi and the model contributions. The workbench models handles this as follows: On first startup, populate the model as described under 1 and 2. Changes during the session will be recorded as deltas, and we persist these deltas instead of the whole model when we shut down. Then, for subsequent startups, populate the model as described under 1 and 2 and then apply any persisted deltas from 3. If there are deltas that don't make any sense then skip them. The delta are applied to the model based on the ID's of the UI component.

5.5. Where to find the meta-model

The workbench model is defined in the plugin "org.eclipse.e4.ui.model.workbench" in the file "model/UIElements.ecore". The "UIElements.genmodel" defines among other things that interfaces for the workbench model starts with M.