LWUIT on Android

Last month I ported a couple of my J2ME/LWUIT apps on Android. I used the LWUIT port from Thorsten [1]. I downloaded the source code from LWUIT incubator SVN [2], but I spent a lot of time in merging the LWUIT original classes with the Thorsten's classes needed to port to Andoid and then I spent a lot of time again to produce a .jar usable with Android SDK.

In this post I want to share the Eclipse project that I created to compile and jar the Thorsten's LWUIT Android port and I want to show how to write a simple HelloWorld LWUIT-Android project.

Requirements:

1) Eclipse Helios or later
2) Android SDK
3) LWUITPortAndroid eclipse projectnz

You can download LWUITPortAndroid from here:LWUITPortAndroid.zip
You may want to update the source code to the latest version of Thorsten's port. If so check out the latest Thorsten's port from the SVN url above and overwrite the classe in my project.
If you don't want to recompile the Android port, you can download only my .jar: LWUITAndroidPort.jar.
Then, I prepared a simple hello world eclipse project to show how to move from and J2ME/LWUIT project to an Android project: HelloWorldLWUITAndroid.zip
Mainly your Android activity must subclass LWUITActivity class and in the method getFullApplicationPath you should return the full name of your midlet class:

public String getFullApplicationPath(){
        return "com.cryptware.HelloWorldMidlet";
        // (make sure that obfuscators don't mess with the class name and path.)
    }

And that's all. You can use your LWUIT midlet on an Android device with a few lines of code.

References:

[1] Thorsten's LWUIT Android port: http://www.pader-sync.com/lwuit-for-blackberry-and-android.html
[2] LWUIT incubator SVN: https://svn.java.net/svn/lwuit-incubator~svn

 


Comments (4) -

  • Do you know where I can download the android sdk?

    Very interesting this post.

    Thanks.
  • ho
    I tried to recompile the LWUIPortAndroid (Just recompile it, no updated code). I open the project in eclipse, fix the JRE and android.jar path, but it still get many warnings in the project. Most of them are something like "Vector is a raw type. References to a generic type Vector <E> should be parameterized". Do you know what is wrong? My JRE version is 7 and jdk compliance level is set to 1.6.

    Thanks

  • ho
    I tried to recompile the LWUIPortAndroid (Just recompile it, no updated code). I open the project in eclipse, fix the JRE and android.jar path, but it still get many warnings in the project. Most of them are something like "Vector is a raw type. References to a generic type Vector <E> should be parameterized". Do you know what is wrong? My JRE version is 7 and jdk compliance level is set to 1.6.

    Thanks

  • ho
    I tried to recompile the LWUIPortAndroid (Just recompile it, no updated code). I open the project in eclipse, fix the JRE and android.jar path, but it still get many warnings in the project. Most of them are something like "Vector is a raw type. References to a generic type Vector <E> should be parameterized". Do you know what is wrong? My JRE version is 7 and jdk compliance level is set to 1.6.

    Thanks

Add comment