×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Series 60 J2ME emulator problems

    Hi!

    Here are some problems (with example code) that I have found when working with the Series 60 J2ME emulator. I hope these will be fixed for next release/real device. All of the examples work fine on other emulators (including nokia 6310i emulator) plus at least on Palm and Motorola Accompli devices.

    1. Following NullPointerException is thrown when I try to change StringItem's text on a form which is not currently shown:

    java.lang.NullPointerException
    at javax.microedition.lcdui.Form.findTextPosition(+43)
    at javax.microedition.lcdui.Form.replaceText(+5)
    at javax.microedition.lcdui.StringItem.setText(+47)
    at ProgressForm.init(+36)
    at FormTest.commandAction(+46)
    at javax.microedition.lcdui.Displayable.commandAction(+29)
    at javax.microedition.lcdui.Toolkit.postEvent(+78)
    at com.symbian.midp.compatibility.runtime.KVMEventProcessor.run(+27)

    Here is example code:

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class FormTest extends MIDlet implements CommandListener
    {
    private Command exitCommand;
    private Command changeCommand;
    private Display display;
    private ProgressForm form;
    private int count = 0;

    public FormTest()
    {
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.EXIT, 2);
    changeCommand = new Command("Change", Command.SCREEN, 1);
    }

    public void startApp()
    {
    TextBox t = new TextBox("FormTest", "Test...", 256, 0);

    t.addCommand(changeCommand);
    t.addCommand(exitCommand);
    t.setCommandListener(this);

    form = new ProgressForm("Progress", Integer.toString(count));

    display.setCurrent(t);
    }

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void commandAction(Command c, Displayable s)
    {
    if (c == exitCommand)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    else
    {
    count++;
    try
    {
    form.init("Progress", Integer.toString(count));
    }
    catch (Exception e)
    {
    e.printStackTrace();
    }
    }
    }
    }

    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;

    public class ProgressForm extends Form
    {
    private StringItem text = null;

    public ProgressForm(String title, String msg)
    {
    super(title);

    init(title, msg);

    this.append(text);
    }

    public void init(String title, String msg)
    {
    setTitle(title);

    if (text == null)
    {
    text = new StringItem(null, msg);
    }
    else
    {
    text.setText(msg);
    }
    }
    }

    -------------------------------------------------------------

    2. I get following application error when I try to re-use an Alert (NT 4.0, Service pack 6):

    kmidp_debug.exe - Application Error

    The instruction at "0x0043cb76" referenced memory at "0x0000003c". The memory could not be "read".
    Click on OK to terminate the application
    Click on CANCEL to debug the application

    Here is example code:

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class AlertTest extends MIDlet implements CommandListener
    {
    private Command exitCommand;
    private Command alertCommand;
    private Display display;
    private Alert alert;

    public AlertTest()
    {
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.EXIT, 2);
    alertCommand = new Command("Alert", Command.SCREEN, 1);
    }

    public void startApp()
    {
    TextBox t = new TextBox("AlertTest", "Test...", 256, 0);

    t.addCommand(alertCommand);
    t.addCommand(exitCommand);
    t.setCommandListener(this);

    display.setCurrent(t);
    }

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void commandAction(Command c, Displayable s)
    {
    if (c == exitCommand)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    else
    {
    showAlert("Alert", "Testing...", AlertType.INFO, Alert.FOREVER);
    }
    }

    private void showAlert(String t, String str, AlertType type, int to)
    {
    if (alert == null)
    {
    alert = new Alert(null);
    }

    alert.setTitle(t);
    alert.setString(str);
    alert.setType(type);
    alert.setTimeout(to);

    display.setCurrent(alert);
    }
    }

    ----------------------------------------------------------

    3. I get following application error when I try to show alert before the first Displayable:

    kmidp_debug.exe - Application Error

    The instruction at "0x0043c30e" referenced memory at "0x00000044". The memory could not be "read".
    Click on OK to terminate the application
    Click on CANCEL to debug the application

    Here is example code:

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    public class AlertTest2 extends MIDlet implements CommandListener
    {
    private Command exitCommand;
    private Display display;

    public AlertTest2()
    {
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.EXIT, 2);
    }

    public void startApp()
    {
    TextBox t = new TextBox("AlertTest2", "Test...", 256, 0);
    t.addCommand(exitCommand);
    t.setCommandListener(this);

    Alert alert = new Alert("Alert", "Test", null, AlertType.INFO);

    display.setCurrent(alert, t);
    }

    public void pauseApp() {}

    public void destroyApp(boolean unconditional) {}

    public void commandAction(Command c, Displayable s)
    {
    if (c == exitCommand)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    }
    }

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    5

    RE: Series 60 J2ME emulator problems

    I am getting the same error message when I try to set an alert to the current displayable. The app works on Motorola SDK, Nokia 6610, Sun SDK, but not on Series 40.
    Did you ever find a resolution to the problem? If you did please let me know. Thanks.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Series 60 J2ME emulator problems

    i get this error at runtime when the thread to send the message is executed

    java.lang.NullPointerException
    at javax.microedition.lcdui.Display.setCurrent(+15)
    at MoboPay.commandAction(+755)
    at javax.microedition.lcdui.Display$DisplayAccessor.commandAction(+282)
    at javax.microedition.lcdui.Display$DisplayManagerImpl.commandAction(+10)
    at com.sun.midp.lcdui.DefaultEventHandler.commandEvent(+68)
    at com.sun.midp.lcdui.AutomatedEventHandler.commandEvent(+47)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.handleVmEvent(+186)
    at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(+57)

    plz help
    thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×