Hey. Im building this J2ME app. Basically, its an alarm, but I got a problem.
I set the alarm and everything and it works perfect, except that the timer never works and I don't know why.
Everytime though, it reaches the alarmTimer.schedule and throws this error:Code:long now = new Date().getTime(); stringItem3 = new StringItem(alarmDate.toString(), null); System.out.println(alarmDate.getTime() - now); long amount = alarmDate.getTime() - now; alarmTimer.schedule(at, amount); //error here System.out.println("im here"); } class Alarmer extends TimerTask { public void run() { System.out.println("i run"); } }
510 is the alarmTimer.schedule line. Any ideas? Please.Code:TRACE: <at java.lang.NullPointerException: 0>, Exception caught in Display class java.lang.NullPointerException: 0 at VisualMIDlet.doAlarm(VisualMIDlet.java:510) at VisualMIDlet.commandAction(VisualMIDlet.java:189) 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.softPress(), bci=29 at com.sun.midp.chameleon.layers.SoftButtonLayer.pointerInput(), bci=142 at com.sun.midp.chameleon.CWindow.pointerInput(), bci=76 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:619)
.
Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS
Website: http://abdn.ac.uk/~u41am6
Opportunity is missed by most people because it is dressed in overalls and looks like work.
You don't show where you initialize the Alarmer object as the name "at", which seems to be the problem. If "at" is not initialized, or for some other reason is NULL, you'll get that exception.
Wow I changed my sig!
Woops. Forgot to initialise either timer... Dam. My bad! Cheers mate.
.
Programming Languages: Java, VB6, VB2005 (.NET2)
Web Languages: HTML, CSS, JS
Website: http://abdn.ac.uk/~u41am6
Opportunity is missed by most people because it is dressed in overalls and looks like work.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks