Android and Eclipse – J2ME and NetBeans (Part 3)
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=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
}
}
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)
- 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.
- 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.
- 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.








![QRcode[761] QRcode:761](http://gerry.ws/wp-content/blogs.dir/2/qrcode-cache/761.jpg)














I’m working on figuring out what program to use… I looked at Eclipse, NetBeans, Mojax and a few others and frankly, my head is spinning.
I need something simple – I’m okay at VB6.0, Basic for programming microcontrollers and Fortran – so coding that’s very cryptic is not easy for me (hence, I’ll never use C++).
Can you recommend something simple, easy to use, that will enable me to write programs for cellphone,blackberry, PDA’s… ?
Thanks
Hi Bruce,
If you’re going to do mostly J2ME software, NetBeans offers a good choice out of the box. Downloading the complete package will get you started quickly.
Eclipse on the other hand needs additional installs of plugins to set you up for J2ME. Although it’s quite supported by a lot of mobile device manufacturers by making their SDKs available to work with Eclipse. Motorola, Android are just a couple of examples.
Thank you. I installed it on my iMac and like it – it’s very much like VB.
Now, my question is this: I built an example program and created the DIST folder. No problem running it on the Mac. But, how do I create the executable/package to run on my Windows XP machine?
I don’t see any info in Help (or website) that points me in the direction. (I hope I won’t need to build a parallel program on a Windows installation of Netbeans).
If you’re developing J2ME software, the programs are supposed to be used on mobile phones. If you want to run it on a Windows machine, you’ll need an emulator on the Windows machine before you can run it.