Install phoneME in Android to run JavaME middlets

As we all know, the Android is similar to JavaME because both runs on Java platform . However instead of executing the classfiles, Android add the extra step of converting the Java bytecode into alternative instruction set used by (into *.dex) Dalvik Virtual Machine, which makes it unable to run Java classfile (*.jar) normally used by JavaME.

Luckily, some brave soul has provided phoneME implementation for Android, which in turn enable users to execute Java MIDlet in Android. phoneME for Android can be downloaded from its website: http://davy.preuveneers.be/phoneme/?q=node/10#android

phoneme screenshot phoneme screenshot phoneme screenshot

What you need to do is to download phoneME Advanced – Foundation Profile + MIDP or phoneME Advanced – Foundation Profile + MIDP High Resolution (240×320). The midlet manager provided with the distribution requires OpenIntents File Manager, which is used to browse for midlet *.jad or *.jar file.

So far, almost all core MIDP 2.0 functionality is available from the phoneME *.apk. The only incompatibilities arises from midlets that use optional JSR, which usually causes midlet manager to crash.

Kirodict – a Compact, Lightweight JavaME mobile dictionary

Finally after spending a couple months working on this on and off personal project, I decided to release the final version of Kirodict – a lightweight mobile dictionary.

As it name implies, Kirodict was designed to be small in size while maintaining its functionality as a fully fledge dictionary for mobile and embedded device. Kirodict acts as a front-end to an RFC2229 (dict.org) compatible server which it obtain the word definition from.

Kirodict - compact mobile dictionary

Its small and compact size as well as its portability makes it an attractive application to be downloaded and installed on your mobile phone. Kirodict requires mobile phones with at least these feature :

  • MIDP 2.0 /CLDC 1.0 compatible phones
  • 128kB of free storage space
  • Phone with network connection (3G, GPRS, Wifi, wimax)

With lower requirements, it can be installed on a lower end phone without much problem. Kirodict does not use additional storage space as it does not cache its results.

Kirodict can be downloaded from Kirodict Google Code project website and it is licensed under the GNU General Public License version 2.0

I bought a new phone – Nokia E71

December 26th, 2008 4 Comments   Posted in J2ME / JavaME, Java, Nokia, Smartphone, Symbian

I know I’ve been slacking lately on my post.. but hey, I got myself a new phone – The Nokia E71!

Phones model and features are getting diverse now and I’ve noticed that its getting harder and harder to choose a phone that really suits my needs. For example, one feature found on Phone A isnt necessarily can be found on Phone B.

So it took me a while to replace my good old 6630 that has been stolen few months before. But hey, I’m back on my feet now.

Nokia E71 papit

Among the key feature that attract me to buy this phone are :

  • Location API support (JSR-179) with built in GPS receiver
  • QWERTY keyboard
  • Ease of handling, my hands a bit slippy on its sister’s phone E66
  • Battery last longer
  • Hot swappable micro-sd card
  • More than adequate internal memory
  • \

  • Supports WiFi

The only drawback that I could think of this phone is its camera that is not as good as the N95,N96 series phone. But I can still live with that since I rarely use the camera anyway.

Other additional feature
The phone comes with Advance Call Manager and Multi Scanner free of charge, making it easier to filter out unwanted call and to manage phone blacklist.

Multi Scanner allows you to take a photo of name card and automatically store important information (Name, Phone Number, Address, Company’s Name, Fax Number) right into the phone.

I hope I can be more productive at updating this blog and producing new mobile applications with this phone.

How to get Nokia Battery Level in JavaME

November 9th, 2008 1 Comment   Posted in J2ME / JavaME, Java, Nokia, Tips, Tricks, Guide

Nokia Symbian 3rd Edition phone introduces “com.nokia.mid.batterylevel” properties which you can get the current battery charge level by calling System.getProperty(“com.nokia.mid.batterylevel”) from within your midlet application. Its up to your imagination for you to do the rest.

Sample source code (displaying battery charge level on gauge):

/**********
/*
/* Nokia Battery Level midlet
/* Copyright 2008 Mohammad Hafiz bin Ismail ([email protected])
/* http://mobilepit.com
/*
/* May be use freely
**********/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class NokiaBattery extends MIDlet implements CommandListener {

int value;
Display display;
Form form;
Gauge gauge;
Command cmdExit;

public NokiaBattery() {
 display = Display.getDisplay(this);
 form = new Form("Nokia Battery");
 cmdExit = new Command("Exit",Command.EXIT,1);
 form.addCommand(cmdExit);
 value=Integer.parseInt(System.getProperty("com.nokia.mid.batterylevel"));
 gauge = new Gauge("Level",false,100,value);
 form.append(gauge);
form.append("Value :"+value);

 StringItem item = new StringItem("Network Signal",System.getProperty("com.nokia.mid.networksignal"));
 form.append(item);
 form.setCommandListener(this);
}

public void startApp(){
      display.setCurrent(form);
}

public void pauseApp() {}

public void destroyApp(boolean flags) {

	notifyDestroyed();
} 

public void commandAction (Command cmd, Displayable disp)
{
	if (cmd == cmdExit) {
	 	destroyApp(false);
	}
}

}

Download source code and sample midlet : NokiaBattery_midlet.zip

How to generate Random Numbers in J2ME application

September 28th, 2007 5 Comments   Posted in J2ME / JavaME, Java, newbie, Tips, Tricks, Guide

One of the popular question asked in this blog is ways to generate random numbers in J2ME application.

As most people probably realized, the JavaME CLDC does not include the Math.Random class to generate random numbers. However one can generate a series of random numbers in JavaME/J2ME application by using the included java.util.Random class.

Here’s a sample usage

import java.util.Random;
...
	Random generator = new Random();
	generator.setSeed(System.currentTimeMillis());
	float f = generator.nextFloat();

	System.out.println(""+(f*100.0f)%100);
...

The sample code above will produce a random floating-point number between 0..100 (exclusive)

Here’s the source code for the full Random Number Demo application : RandomDemo.java,

The best J2ME MIDlet icon size settings

Although not required, It is nice to include icon in your MIDlet distribution as it give a unique feeling to your mobile application. The only problem is different device seems to have different icon sizes requirements for tJ2ME MIDlet.

The Ideal Icon size guidelines for different mobile device
Here is the icon size guideline for different devices

Nokia

  • Series 40 – 128×160=24×24, 208×208=46×46, 240×320=46×48
  • S60 1st and 2nd – 176×208=42×29, 352×416=76×76
  • S60 3rd – 176×208=31×31, 208×176=37×37, 352×416=76×76, 240×320=53×53/55×55, 320×240=52×52/54×54, 208×208=37×37
  • N90/N95 : 84×58

Samsung & Sony Ericsson
Most Samsung phone accept 16×16, 32×32 icon size

Motorola
15×15, 16×16, 32×32

Most phone seems to accept 8bit-depth color for MIDlet icons, except Nokia S60 3rd edition which seems display 24bit icon quite well.

Note that most of this figure are based on experiments and observation on different phone models.

[tags]midlet,java,j2me,javame,midp,midp2,symbian,nokia,motorola,sony ericsson[/tags]


This blog is protected by dr Dave\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'s Spam Karma 2: 174433 Spams eaten and counting...