English 中文(简体)
在J2ME转换显示器时设定一个无效的例外
原标题:Getting a nullpointer exception when switching displayables in J2ME

因此,我大米在我的J2ME申请中增加了一个表格,但在试图回到主屏幕上时,总是得到一个无名的例外。 当我用一枚血管,我能够成功地回到主菜园时,这似乎不会发生。 什么?

表格从主要中点开始

quickAlarm = new QuickAlarm("Set quick alarm",this);
                display.setCurrent(quickAlarm);

快速反应部队

public QuickAlarm(String title,HelloMIDlet midlet) {
      super(title);
      df = new DateField("Alarm time",DateField.TIME);
      this.append(df);
      this.midlet = midlet;

      backCommand = new Command("Back",Command.BACK,0);
      saveCommand = new Command("Save",Command.OK,1);

      this.addCommand(backCommand);
      this.addCommand(saveCommand);
    }

从QuickAlarm返回主菜,

this.midlet.leaveCanvas();

这是主要的中点。

 public void leaveCanvas() {
      display.setCurrent(startOptions);
 }

完全错误是

TRACE: <at java.lang.NullPointerException:   0>, Exception caught in Display class
java.lang.NullPointerException:   0
        at javax.microedition.lcdui.Display$ChameleonTunnel.callScreenListener(), bci=46
        at com.sun.midp.chameleon.layers.SoftButtonLayer.processCommand(), bci=74
        at com.sun.midp.chameleon.layers.SoftButtonLayer.soft1(), bci=37
        at com.sun.midp.chameleon.layers.SoftButtonLayer.keyInput(), bci=36
        at com.sun.midp.chameleon.CWindow.keyInput(), bci=38
        at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handleKeyEvent(), bci=17
        at com.sun.midp.lcdui.DisplayEventListener.process(), bci=277
        at com.sun.midp.events.EventQueue.run(), bci=179
        at java.lang.Thread.run(Thread.java:637)
最佳回答

令人不安的是,我只是想召集指挥员。

问题回答

界定什么是“QuckAlarm”和“Options”。 您应能通过“显示”方法中的“可分”物体。 因此,就“QuckAlarm”和“Options”进行核对,它们是“javax.microedition.lcdui.Dissmetable”的子类。





相关问题
add text in http request string url

ok i made a midlet through which i can connect to server pages and get soem information as response. For example i made a midlet through which i acced url: http://example.com/?u=nepal&t=1 Now i ...

Do I have to do a setSize() on a Vector before using it?

Given private final Vector v = new Vector(); //instance variable the following 3 lines are in an instance method in the same class. 1. int length = v.capacity(); 2. int size = v.size(); ...

Is the situation with Java ME improving?

It seems to be the consensus that developing for Java ME is not as cross platform as you might expect, particularly compared to say java SE, but it is difficult to assess how the situation is evolving....

Privileged operations in netbeans mobility

I m writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background ...

ClassFormatError: 56 while using hessian in j2me

I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0. http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone ...

热门标签