Protocol Buffer Anyone?

We often discuss XML and JSON as the data formats for client server computing over the web. Another format – Protocol Buffer (protobuf) – is gaining ground. It is a binary format and the size of messages are much smaller than XML or JSON.

But, things begin to get cloudy. XML and JSON can be compressed in flight. Compressed XML and JSON messages are actually smaller than protobuf.

Even with compressed XML and JSON, benchmarks show that protobuf can be faster. This IBM DeveloperWorks article gets into that. Note: The article does not explicitly say that the performance benchmark was done for compressed XML and JSON. The author has confirmed that in the follow on discussion, seen below the article.

Getting Started With Android 2.2

I have often found that Google’s quick start guide for Android development lacks crucial details. Finally, I decided to do something about it. This tutorial should help an absolute new comer to Android programming.

Before you start, make sure that you have these installed:

  • JDK 6. Just JRE is not enough. You will need to install full JDK.
  • Eclipse Galileo

Install Android 2.2 Platform

Download android SDK 2.2 from this link. Unzip the ZIP file under C:\. This should create the C:\android-sdk-windows folder.

Add C:\android-sdk-windows to the PATH environment variable.

Log off and log back in for the change to PATH to take effect.

Now, we will download the Android 2.2 platform.

From the C:\android-sdk-windows\tools folder, run android.bat.

image

Select Settings on the left hand list.

Check the Force https checkbox as shown above.

image

Select Available Packages.

On the right hand side, select SDK Platform Android 2.2, API 8, revision 1 as shown above.

Click Install Selected to start installation.

image

Click Install.

image

When installation finishes, click on Close.

Install Eclipse Plugin

Make sure that you have added the SDK directory to PATH environment variable.

Launch Eclipse.

Select Help > Install New Software.

Click the Add button to add a new site.

image

Add the https://dl-ssl.google.com/android/eclipse/ URL as the new site. Click OK.

image

Expand Developer Tools and check Android Development Tools.

Click Next.

image

Click Finish.

image

Click OK.

image

Click Yes to restart Eclipse.

Create a Virtual Device

An Android Virtual Device (AVD) is a device (phone) emulator. You will use it to test and debug applications.

From Eclipse menubar, select Window > Preferences.

image

Select Android.

Click Browse button and select the directory where the SDK was installed (C:\android-sdk_r06-windows in our case).

Click OK.

From menubar, select Window > Android SDK and AVD Manager.

Select Virtual Devices on the left.

Click New.

image

Enter my_avd as the name. Select Android 2.2 as the target.

Click Create AVD.

Close the AVD manager.

Write a Simple Application

We will now develop a basic application to test our development environment.

in Eclipse, select File > New > Project from the menubar.

image

Expand Android and select Android Project.

Enter the values as shown below.

image

Click Finish.

Expand the HelloWorld project and then src > com.webage.hello.

image

Open HelloActivity.java.

Change the onCreate method as follows.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("Hello World!");
    setContentView(tv);
}

Organize imports (Control+Shift+O).

Save changes.

Test the Application

While the editor for HelloActivity.java is active, from the menubar, select Run > Run.

image

Select Android Application. Then click OK.

System will start the Android Virtual Device. This can take up to 5 minutes. While the device is booting, the screen will look like this.

image

Then, you will see the home screen.

image

Finally, the application will be started.

image

To exit the application, click the home button.

image

Congratulations, you have successfully installed the Android development environment and tested your first Android application.

Mobile Computing Stream Launched

At Web Age Solutions, we have discussed offering a curriculum on iPhone/iPod touch/iPad and Android OS for a long time. Our training has been always geared towards the large enterprise type businesses. The timing is just right. While iPhone is not new, the enterprise scale businesses are beginning to get into the platform. Mobile platforms are filling in various gaps left open by a PC and browser based combination. Mobile apps are special purpose. They can offer data and services more efficiently than a browser. I am a huge fan of soccer. I use the ESPN World Cup soccer app for iPod Touch several times a day. It gives me just what I need to know, including video, very quickly. I can be anywhere in the house or out for a walk. In contrast, I have been to the ESPN’s World Cup soccer web site only twice. These apps are excellent for building brand loyalty. They do that by offering valuable information about a company’s products and services within a few taps.

Today, our Mobile Computing stream finally went live. Right now, there is only one course – WA1920 iPhone Application Development Using SDK 4 and 3. It’s a 3 day course right now. The goal is to turn a C++ and Java developer into a full fledged Apple mobile developer within three days. We may add an extra day of Objective-C, if that is what our clients find useful.

Courses on Android are coming soon!