Hello,
I'm building a program that gets the value of a TextField, concatenate with some other Strings and then display them on a TextBox when the ScreenCommand is clicked, the problem is that it's calling a NullPointerException. My code is like this(of course it has a lot more stuff):
/* .... */
} else if (command == submitCommand) {
FirstPart();
// write pre-action user code here
switchDisplayable(null, getTextBox3());
// write post-action user code here
}
/* .... */
public void FirstPart() {
String test = null;
test = "tst" + textField.getString() + "test";
textBox3.setString(test);
}
/* .... */
And I get this when I click the menu:
TRACE: <at java.lang.NullPointerException: 0>, Exception caught in Display class
java.lang.NullPointerException: 0
at mp.releaser.MPReleaser.FirstPart(MPReleaser.java:535)
at mp.releaser.MPReleaser.commandAction(MPReleaser.java:128)
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.commandSelected(), bci=11
at com.sun.midp.chameleon.layers.MenuLayer.pointerInput(), bci=188
at com.sun.midp.chameleon.CWindow.pointerInput(), bci=88
at javax.microedition.lcdui.Display$DisplayEventConsumerImpl.handlePointerEvent(), bci=19
at com.sun.midp.lcdui.DisplayEventListener.process(), bci=296
at com.sun.midp.events.EventQueue.run(), bci=179
at java.lang.Thread.run(Thread.java:680)
What should I do to correct this?
Best Regards,
Nathan Paulino Campos
*PS: Netbeans should have a `NullPointerException` corrector tool :P*