Can anyone see whats wrong with this... It builds ok in WTK 2.5.1 but when loaded to i415 Motorola phone it says "Unhandled Exception"
Just trying to get the battery level from the phone. I KNOW this CAN be done on Motorola i415 but I just cannot seem to figure it out. 3 days is enough searching... please help!
Code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.location.*;
public class HelloMidp extends MIDlet implements CommandListener {
private Command exitCommand;
Display display;
Form mainForm;
public HelloMidp () {
exitCommand = new Command("Exit", Command.EXIT, 1);
mainForm = new Form ("HelloMidp");
String batt = System.getProperty("batterylevel");
mainForm.append (batt);
}
protected void startApp()
{
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
Display.getDisplay(this).setCurrent(mainForm);
}
/**
* This method is called to notify the MIDlet to enter a paused
* state. The MIDlet should use this opportunity to release
* shared resources.
*/
protected void pauseApp() {}
/**
* If the MIDlet was using resources, it should release
* them in this method.
*/
protected void destroyApp(boolean bool) {}
public void commandAction(Command cmd, Displayable disp)
{
if (cmd == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}
[ June 16, 2007: Message edited by: Bear Bibeault ]