Building the Mobislim BMI Java App

2 01 2009

I started out with the objective of creating an application for mobile. Even with my limited knowledge of Java and having never programmed anything for mobile before, it was surprisingly simple.


The first thing I did was go to the Java website where I found the Java Mobile Edition Software Development Kit ( I downloaded it, and then tried to install it. Unfortunately, it wouldn’t let me install it as I was missing the Java Development Kit. I went back to the Java site and found it on this page It is worth noting that the top download is the Java Runtime Environment. I almost made the mistake of downloading it, the one I needed for Java ME was the Java SE Development Kit.


Once the Java SDK had finished downloading, I installed it, and then installed Java ME. Both installed without errors, so I went ahead and started up Java ME.


Once Java ME had started, I created a project by clicking File -> New Project -> Java ME SDK -> MIDP Application.


After clicking next, I entered “HelloWorld” as my Project Name. As it was my first time using Java ME, I left the two checkboxes checked as they were by default. The HelloMIDlet created a simple hello world MIDlet for me, which I found really useful in getting going.


After clicking next again, I selected the DefaultCldcJtwiPhone1 from the drop down list. This was as it had the lowest phone requirements, so I assumed that it would work on the greatest number of phones.


I clicked finish, and I was presented with my project on the left hand side, and my HelloMIDletcode on the right. I decided to see what the default code did by clicking the “Run Main Project via OTA” button. This is the blue button at the top with a green play button on it. The application started up in the emulator and said Hello World. Great!


Next, I played with the default code seeing what I could do, but I found the default code very limiting. After about 10 minutes, I had created my own version of the hello world application, which was a really good starting point. This is the code I came up with:


    public void startApp() {


        // Create a form with the title My First App

        Form mainForm = new Form(“My First App”);


        // Add the text “Hello World” to the page

        mainForm.append(“Hello World”);


        // Add an exit button to the page




        // Display the page





Anything that I now put in the area where it says Hello World would now appear within my application. Easy!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: