JavaMidlet Logo

Android and Eclipse - J2ME and NetBeans (Part 3)

 

Posted under: Java Mobile Development Software

Posted by: on Jan 15, 2008

Views: 1,444 views Click to print: Print This Post Click to email: Email This Post

To follow-up on my previous post, here’s the generated Android source code using the Eclipse IDE with the Android plugin installed. I found some interesting observations between J2ME and Android.

Here’s the Android source code generated in Eclipse (HelloAndroid.java and R.java):

HelloAndroid.java

package com.google.android.hello;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
}
}

R.java


/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/

package com.google.android.hello;

public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0×7f020000;
}
public static final class layout {
public static final int main=0×7f030000;
}
public static final class string {
public static final int app_name=0×7f040000;
}
}

The Android code has been divided into two files HelloAndroid.java and R.java. The HelloAndroid.java source file is short and simple. It contains the most basic code needed to create an Android program. The second file, R.java, contains the class the resources needed like the string to display (in this case Hello Android).

Some Observations between the two codes (J2ME generated by NetBeans and Android generated in Eclipse)

  1. The Android code is simple while the J2ME code has been created so that it will be easier to use the graphical interface tools inside NetBeans that will allow for some ease in development.
  2. Although not so obvious, both code has some common ground. Like for instance the use of the javax.microedition.lcdui library. Another library that is interestingly included in Android is the javax.microedition.khronos library — at least part of it. The khronos library contains the 3D Java implementation of JSR 239.
  3. The Android library seems to include some other libraries from different open source projects as well. For instance, the Bouncy Castle encryption library project, Apache’s Harmony and SQLite to name a few are also included.

One thing I would really like to see is Android getting into NetBeans and be able to use the different GUI tools available in the IDE. This will definitely help new developers in getting their feet wet at creating Android programs. But hey who’s to stop you from still developing Android programs. Heck you can even do it without Eclipse if you want to.

With March 2008 just around the corner, maybe we’ll start seeing a lot of Android programs (and Android hardware too) popping up.

Comments

Leave a Reply

« Google's Android shows up on HTC’s Qtek 9090
Looks like NetBeans v6.1 is looming in the air »